0% found this document useful (0 votes)
24 views1 page

Js

The document contains Google Apps Script functions for a web application. The 'doGet' function serves an HTML template, while 'checkLogin' verifies user credentials against a Google Sheet. Additionally, the 'AddRecord' function appends new user data to the same sheet.

Uploaded by

sp729710
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views1 page

Js

The document contains Google Apps Script functions for a web application. The 'doGet' function serves an HTML template, while 'checkLogin' verifies user credentials against a Google Sheet. Additionally, the 'AddRecord' function appends new user data to the same sheet.

Uploaded by

sp729710
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

function doGet(e) {

var x = HtmlService.createTemplateFromFile("index");
var y = x.evaluate();
var z = y.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
return z;
}

function checkLogin(username, password) {


var url = 'Sheet Link';
var ss= SpreadsheetApp.openByUrl(url);
var webAppSheet = ss.getSheetByName("DATA");
var getLastRow = webAppSheet.getLastRow();
var found_record = '';
for(var i = 1; i <= getLastRow; i++) {
if(webAppSheet.getRange(i, 1).getValue().toUpperCase() == username.toUpperCase()
&&
webAppSheet.getRange(i, 2).getValue().toUpperCase() == password.toUpperCase())
{
found_record = 'TRUE';
break; // Stop loop once a match is found
}
}
if(found_record == '') {
found_record = 'FALSE';
}

return found_record;
}

function AddRecord(username, password, email, phone) {


var url = 'Sheet Link';
var ss= SpreadsheetApp.openByUrl(url);
var webAppSheet = ss.getSheetByName("DATA");
webAppSheet.appendRow([username, password, email, phone]);
}

You might also like