Replace Link Spreadsheet

What do you mean by access?

Do you want to open the spreadsheet on your device, or send data to it (then get data from it) ? Or something else?

Yes you get the point. I mean, when we get the link and then how to access (open the spreadsheet) by device by a button

Not going to play pin the tail on the donkey....

https://ai2.metricrat.co.uk/_/search?query=sheet&scope=site&showTabs=false&page_token=CKywiKHZLhAA

image
when I get to open the spreadsheet by the link that we generate / get. I will to copy the data from excell and then the Spreadsheet URL I Put it to the google app script by a button after that I'm gonna to input the data(time) by scan QRcode

<var ss = SpreadsheetApp.openByUrl("linkspreadsheet");
var sheet = ss.getSheetByName("Sheet1");

function doGet(e){
  var action  = e.parameter.action;
  
  if(action == "in")
    return inTime(e);
   
  if(action == "out")
    return outTime(e);
  
}


function doPost(e){
  var action  = e.parameter.action;
  
  if(action == "in")
    return inTime(e);
   
  if(action == "out")
    return outTime(e);
  
}

function inTime(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 in_time = Utilities.formatDate(new Date(), "IST", "HH:mm:ss");
      sheet.getRange(i,3).setValue(in_time);
      return ContentService.createTextOutput("Thank You ! Your In Time is "+in_time).setMimeType(ContentService.MimeType.TEXT);
    }
  }
  return ContentService.createTextOutput("Id Not Found").setMimeType(ContentService.MimeType.TEXT);
}


function outTime(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 out_time = Utilities.formatDate(new Date(), "IST", "HH:mm:ss");
      sheet.getRange(i,4).setValue(out_time);
      return ContentService.createTextOutput("Thank You ! Your Out Time is "+out_time).setMimeType(ContentService.MimeType.TEXT);
    }
  }
  return ContentService.createTextOutput("Id Not Found").setMimeType(ContentService.MimeType.TEXT);
}>Preformatted text

I Hope you can solve it ! Please!

what the code for get url spreadsheet that active and get sheet that active?

See here:

How to Input data with color cell in spreadsheet by app mit app inventor use google script

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.