如何在Google表格电子邮件中添加"修改回复"链接?

Das*_*shK 25 google-apps-script google-forms

我有一个简单的Google表单来收集数据,并使用AppScript向填写完成的用户发送确认电子邮件.用户提交表单后,在确认后,他/她将看到一个链接来编辑他/她的回复.

我想将该链接作为确认电子邮件的一部分包含在内(现在,它只显示在页面上.)如何获取用于编辑已提交回复的URL?

我能够获得表格的链接SpreadsheetApp.getActiveSpreadsheet().getFormUrl().它给了我以下格式:https://docs.google.com/a/domain.com/spreadsheet/viewform?formkey=<formKey>

但是该链接不包括编辑密钥,这是用户编辑他/她的响应所必需的.预期的URL应如下所示:https://docs.google.com/a/domain.com/spreadsheet/viewform?formkey=<formKey>&edit=<editKey>

我在这里先向您的帮助表示感谢!

-K

编辑:

添加了一项功能请求:http://code.google.com/p/google-apps-script-issues/issues/detail?id = 1345&thanks = 1345&ts = 1337773007

Ben*_*Ben 21

@Henrique Abreu无法做到这一点的答案直到最近都是如此.Google似乎已经添加getEditResponseUrl()FormResponse类中,因此可以使用这样的代码来获取一堆现有表单的编辑URL:

function responseURL() {
 // Open a form by ID and log the responses to each question.
 var form = FormApp.openById('1gJw1MbMKmOYE40Og1ek0cRgtdofguIrAB8KhmB0BYXY'); //this is the ID in the url of your live form
 var formResponses = form.getResponses();
 for (var i = 0; i < formResponses.length; i++) {
   var formResponse = formResponses[i];
   Logger.log(formResponse.getEditResponseUrl());
 }
}
Run Code Online (Sandbox Code Playgroud)

要使用户在响应时自动向用户发送电子邮件,可以在表单提交时添加触发器.由于我正在使用的情况不要求人们使用应用程序帐户登录我无法自动访问电子邮件地址,因此我有一个文本问题可以捕获用户的电子邮件地址.

它确实询问是否编辑表单是你想要的问题.我一直在努力解决编辑现有响应或发送预填充表单的相对优势,toPrefilledUrl()以便我可以看到事情随着时间的推移发生了变化.我想这归结为跟踪它将为您提供的价值.