0% found this document useful (0 votes)
26 views

Send and Read One Data

script

Uploaded by

Johan Yan
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Send and Read One Data

script

Uploaded by

Johan Yan
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

function doGet(e) {

return ManageSheet(e);
}
function doPost(e) {
return ManageSheet(e);
}

function ManageSheet(e) {

//CREATE NEW RECORD


if (e.parameter.func == "Create") {

var ss = SpreadsheetApp.getActive();

var sh = ss.getSheets()[0];

var data =[e.parameter.Name, e.parameter.PhoneNumber,e.parameter.Gmail];

sh.appendRow(data);

return ContentService.createTextOutput("Success");

else if ( e.parameter.func == "ReadOneRecord") {


var ss = SpreadsheetApp.getActive();
var sh = ss.getSheets()[0];
var rg = sh.getDataRange().getValues();
var outString = '';
outString += rg[parseInt(e.parameter.id)].join('**');
return
ContentService.createTextOutput(outString).setMimeType(ContentService.MimeType.TEXT
);
}

You might also like