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

Spreadsheet Code

This document contains a Google Apps Script that interacts with a Google Sheet to store data. It defines functions to handle GET and POST requests, logging received parameters and storing a name along with the current date and time in specified columns. The script also includes a utility function to strip quotes from input values.

Uploaded by

Konrad Dela Cruz
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)
4 views1 page

Spreadsheet Code

This document contains a Google Apps Script that interacts with a Google Sheet to store data. It defines functions to handle GET and POST requests, logging received parameters and storing a name along with the current date and time in specified columns. The script also includes a utility function to strip quotes from input values.

Uploaded by

Konrad Dela Cruz
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

var ss = SpreadsheetApp.

openById('Enter Sheet ID');


var sheet = ss.getSheetByName('Sheet1');
var timezone = "Enter Time Zone of Your Country";

function doGet(e){
Logger.log( JSON.stringify(e) );
if (e.parameter == 'undefined') {
return ContentService.createTextOutput("Received data is undefined");
}
var Curr_Date = new Date();
var Curr_Time = Utilities.formatDate(Curr_Date, timezone, 'HH:mm:ss');
var name = stripQuotes(e.parameters.name);
var nextRow = sheet.getLastRow() + 1;
sheet.getRange("A" + nextRow).setValue(name);
sheet.getRange("B" + nextRow).setValue(Curr_Date);
sheet.getRange("C" + nextRow).setValue(Curr_Time);

return ContentService.createTextOutput("Card holder name is stored in column A");


}

function stripQuotes( value ) {


return value.toString().replace(/^["']|['"]$/g, "");
}

function doPost(e) {
var val = e.parameter.value;

if (e.parameter.value !== undefined){


var range = sheet.getRange('A2');
range.setValue(val);
}
}

You might also like