This should get you going, (assumes no header row for the data on the sheet). All the work is done in the web app, no usernames or passwords are returned to the AI2 app:
SHEET
SCRIPT
///// check username and password and return output
function doGet(e) {
var message = "";
var ss = SpreadsheetApp.openById(e.parameter.sheetId);
var sh = ss.getSheetByName(e.parameter.gridName);
var rg = sh.getName() + "!" + sh.getDataRange().getA1Notation();
var sql = e.parameter.query;
var qry = '=query(' + rg + ',\"' + sql + '\",0)';
var ts = ss.insertSheet();
var setQuery = ts.getRange(1,1).setFormula(qry);
var getResult = ts.getDataRange().getValues();
ss.deleteSheet(ts);
if (getResult[0][0] == "#N/A") {
message = 'username not present';
} else {
if (getResult[0][1] != e.parameter.pwd) {
message = 'incorrect password';
} else {
message = 'signed in';
}
}
return ContentService.createTextOutput(message);
}
BLOCKS
SCREENS
GUIDES
- HOWTO: Create a Google Apps Script Web App bound to a Spreadsheet
- Query Any Google Sheet with a Web App
- Correctly Deploy a Google Apps Script Web App for AI2
- New Versions for New Google Script Editor
AIA
GSLogin.aia (3.0 KB)






