-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGapp-script_1
More file actions
34 lines (24 loc) · 750 Bytes
/
Gapp-script_1
File metadata and controls
34 lines (24 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function doGet(e){
var ss = SpreadsheetApp.getActive();
var sheet = ss.getSheetByName(e.parameter["id"]);
var headers = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues()[0];
var lastRow = sheet.getLastRow();
var cell = sheet.getRange('a1');
var col = 0;
var d = new Date();
for (i in headers){
// loop through the headers and if a parameter name matches the header name insert the value
if (headers[i] == "Timestamp")
{
val = d.toDateString() + ", " + d.toLocaleTimeString();
}
else
{
val = e.parameter[headers[i]];
}
// append data to the last row
cell.offset(lastRow, col).setValue(val);
col++;
}
return ContentService.createTextOutput('success');
}