How to Sent DatePicker to spreadsheet use Google Script
More information needed:
- Date format to send?
- Where should the first picked date go once sent to spreadsheet?
- Where does the next picked date need to go?
- What response is required from the script ?
- Is that all you need to do?
I have to do but for now the problem is How to bring the result of Date Picker selected and the Listpicker Selected to each Colomn at the first Row. ? May you able to solve these. What the Through Script and Blockcodes?. Thanks in advance!
Use the same method as you have for the In Time and Out Time?
supper sorry I'm a beginner in programming, so I don't understand about the codes/script and how to change the code by I my logic. I just follow the tutorials
source : https://www.crazycodersclub.com/android/qr-scan-attendance-app-using-app-inventor-google-sheet-app-script/. may you show to me?
no there are use scan barcode, but this is use manual method. how to do this?
See the script code for function setDate(e)
.
From the app you will need to send 3 parameters:
?action=date
&id=<the id for the date>
&date=<the date from the picker>
then your google apps script web app:
var ss = SpreadsheetApp.openByUrl("linkspreadsheet");
var sheet = ss.getSheetByName("Sheet1");
function doPost(e){
var action = e.parameter.action;
if(action == "in")
return inTime(e);
if(action == "out")
return outTime(e);
if(action == "date")
return setdate(e);
}
function setDate(e){
//sets the id
var id = e.parameter.id;
//sets the date
var date = e.parameter.date;
//gets the id values from the sheet
var values = sh.getRange(2,1,sh.getLastRow(),1).getValues();
//iterates over the id values to find a match
//with the id parameter
for(var i = 0 ; i<values.length ; i++){
if(values[i][0] == id){
//corrects sheet row number
i=i+2;
//sets value of cell to the date parameter
sh.getRange(i,5).setValue(date);
//returns confirmation that date is set
return ContentService.createTextOutput("Date Set is: "+date).setMimeType(ContentService.MimeType.TEXT);
}
}
return ContentService.createTextOutput("Id Not Found").setMimeType(ContentService.MimeType.TEXT);
}
function inTime(e) {
//code
}
function outTime(e){
//code
}
See how I change the number value here
to ensure the date goes to the correct column.
You can use much the same code for your "subject" column.
Ok, thanks for the tutor