[英]doPost(e) google script
I'm currently working with Google Script and I have a problem with doPost(e)
, every time I send a POST request to the script I keep getting undefined the variable e 我目前正在使用Google脚本,而
doPost(e)
则有问题,每次我向脚本发送POST请求时,我都会不断得到未定义的变量e
My code: 我的代码:
function doPost(e){
var company = JSON.parse(e.postData.contents)['meta']['company_id'];
var s = SpreadsheetApp.openById('1lEp4Ul0D3eGsIEbjS6rFhjVVVjH6v5ZJvxRfGr5WLWQ');
var ss = s.getSheetByName('Hoja 1');
var token = 'hidden secret token';
// get previous and current data from post
var previous = JSON.parse(e.postData.contents)['previous'];
//set the previous stage id to current object
current['previous_stage_id'] = previous['stage_id'];}
the post responses are all raw body. 帖子的回复全是原始的。
If this information is supposed to cause something to happen on the script side of things you need to add a 如果此信息应该导致脚本方面发生某些事情,则需要添加一个
google.script.run.functionName(responseValues)
to the HTML. 到HTML。 If the HTML needs to get values back add a handler.
如果HTML需要返回值,则添加一个处理程序。
google.script.run.withSuccessHandler(doSomething).functionName()
The doSomething is JS on the page and the functionName is a google script function. doSomething是页面上的JS,而functionName是Google脚本函数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.