Dear Forum,
I saw a few videos and would ask for your assistance since i am stuck to proceed.
sourcecode 1
Source Code 2
now I would like that the App Script are combined on the return aspect of the 3 source codes
meaning that when the QR code is scanned, the return should be the name as well as intime.
additionally the intime is recorded on the google sheets.
I would really appreciate the assistance since I am stuck
Souce code one codes are below
> var ss = SpreadsheetApp.openByUrl("Your Spread Sheet URL");
> var sheet = ss.getSheetByName("Sheet1");
> function doGet(e){
> return search(e) ;
> }
> function doPost(e){
> return search(e) ;
> }
> function search(e){
> var id = e.parameter.id;
> var values = sheet.getRange(2, 1, sheet.getLastRow(),sheet.getLastColumn()).getValues();
> for(var i = 0;i<values.length; i++){
> if(values[i][0] == id ){
> i=i+2;
> var name = sheet.getRange(i,2).getValue();
> return ContentService.createTextOutput(name).setMimeType(ContentService.MimeType.TEXT);
> }
> }
> return ContentService.createTextOutput("Id not found").setMimeType(ContentService.MimeType.TEXT);
> }
source code 2 codes are below
var ss = SpreadsheetApp.openByUrl("Your spreadsheeturl");
var sheet = ss.getSheetByName("Sheet1");
function doGet(e){
var action = e.parameter.action;
if(action == "in")
return verified(e);
}
function doPost(e){
var action = e.parameter.action;
if(action == "in")
return verified(e);
}
function verified(e){
var id = e.parameter.id;
var values = sheet.getRange(2,1,sheet.getLastRow(),1).getValues();
for(var i = 0 ; i<values.length ; i++){
if(values[i][0] == id){
i=i+2;
var verified = Utilities.formatDate(new Date(), "GMT", "HH:mm:ss");
sheet.getRange(i,3).setValue(verified);
return ContentService.createTextOutput("Thank You ! Your In Time is "+verified).setMimeType(ContentService.MimeType.TEXT);
}
}
return ContentService.createTextOutput("Id Not Found").setMimeType(ContentService.MimeType.TEXT);
}