-
I have a project where I am trying to send data directly into google spreadsheets through google script. I have a get function in google script:
function doGet(e) { var obj = e.parameter; var data = []; var key = "spreadsheetKey"; var sheetName = "Names"; for(var name in obj) { data.push(obj[name]); } var sheet = SpreadsheetApp.openById(key).getSheetByName(sheetName); sheet.appendRow(data); var result = {result:data}; //could be any value that you want to return return ContentService.createTextOutput(JSON.stringify(result)).setMimeType(ContentService.MimeType.JSON); }
As of now this script will return the same data it was sent in JSON format. The problem I have at this moment is that google redirects the get call to another page. See bottom of this page. How do I get espruino to redirect?? Thank you in advance for your help on the subject.
Thats probably what is going on. The headers.location returns the same url, not the one we are supposed to be redirected to. It also tries to set a cookie.