小编Lee*_*bel的帖子

如果将表单设置为收集电子邮件,则通过 Google Apps 脚本提交 Google 表单将失败

通过 Apps 脚本提交表单时,如果表单设置为收集用户电子邮件以进行回复,则代码将失败并显示错误:

“抱歉,无法提交表单回复。请等待几分钟,然后重试。”

我认为谷歌可能已经改变了一些东西,因为去年运行的代码今年不起作用。

错误指向代码中的“提交”行。或者有时,代码运行,但仍然没有出现在工作表中,或者在表单本身的“响应”中。

如果我关闭收集电子邮件的选项,它运行良好,我会在 Google 表格中看到提交,只是没有电子邮件地址。

我设置了一个测试表单,将其附加到一个新的谷歌表以供回复,并粘贴到我的代码中:

function codeVoteDoVoteByForm()
{
  
  // Get the Yes/No Google form
  var myForm = FormApp.openById('File ID Here')

  // Get a list of questions on it
  var questions = myForm.getItems()
 
  // Get question 0 (only one on this form) and mark it as multiple choice
  var qt = questions[0].asMultipleChoiceItem()
  
  // Set the users vote
  var qr = qt.createResponse("I am here")
  
  //Create the response
  var FormResponse = myForm.createResponse()
  var testemail = FormResponse.getRespondentEmail()
  // Submit …
Run Code Online (Sandbox Code Playgroud)

form-submit google-apps-script google-forms

5
推荐指数
1
解决办法
2186
查看次数