Google 表单提交触发器上的应用脚本:部署在电子表格中与部署在表单中
Google App Script on form submit trigger: deployed in the spreadsheet vs deployed in the form
凭直觉,我在表单的脚本编辑器中设置了一个 on form submit
函数并相应地设置了触发器。
function onSubmit(e) {
console.log(e);
}
但是,输出就像
response
为空。
然后我把这个函数移到相应的电子表格的代码编辑器中并设置了触发器,这次它起作用了。事件对象就像它在 https://developers.google.com/apps-script/guides/triggers/events?hl=en#form-submit
上所说的那样
那么为什么这个触发器必须在电子表格中?对于表单,当有人提交他们的响应时,该函数就会被执行,所以触发器设置正确,为什么事件对象不包含响应?
e.response
对象是 FormResponse class. To inspect its contents, use the methods listed in the reference 的实例。
凭直觉,我在表单的脚本编辑器中设置了一个 on form submit
函数并相应地设置了触发器。
function onSubmit(e) {
console.log(e);
}
但是,输出就像
response
为空。
然后我把这个函数移到相应的电子表格的代码编辑器中并设置了触发器,这次它起作用了。事件对象就像它在 https://developers.google.com/apps-script/guides/triggers/events?hl=en#form-submit
上所说的那样那么为什么这个触发器必须在电子表格中?对于表单,当有人提交他们的响应时,该函数就会被执行,所以触发器设置正确,为什么事件对象不包含响应?
e.response
对象是 FormResponse class. To inspect its contents, use the methods listed in the reference 的实例。