FormApp.openById() - 找不到具有给定ID的项目

时间:2015-10-26 19:04:29

标签: javascript google-apps-script google-sheets

我有一个Google表单触发器功能,在表单上提交根据为我的一个问题选择的值在表单中提交提交。我正在尝试使用“Test as a Add-On”功能来测试我的功能,但是当我提交表单时,我在onSubmit函数中收到错误,错误消息No item with the given ID could be found, or you do not have permission to access it. (line 9, file "Code")来自trigger { {1}}

这是错误的一行,

formSubmit

这让我觉得存在身份验证问题,但我不确定如何进一步调试

完整代码:

  var form = FormApp.openById(ss.getFormUrl());

1 个答案:

答案 0 :(得分:0)

ss.getFormUrl()openByUrl()的组合不对。在krossovochkin的回答中,使用了var form = FormApp.openByUrl(ss.getFormUrl());

openById()

如果您想使用void*,则需要从网址中提取ID。 (见Adding Tabs to Google Sheets Based on Form Response。)