Retrieving the link to a response from a Google Form

僤鯓⒐⒋嵵緔 提交于 2020-06-16 00:36:11

问题


I have a script attached to a Google Form which sends a notification to a Discord channel on submission. I want to include a direct link to the individual response (link looks like https://docs.google.com/forms/d/<myformid>/edit#response=<responseid>). How can I retrieve that link? I get part of the link up to /edit with Form.getEditUrl() but I can't get the correct id. I checked FormResponse.getId() but that doesn't link me to any response.

Here's how to get to that link manually via edit form:


回答1:


Since you know the response Id, you can use the geEditResponseUrl method to get the direct link to the form response. Do note that anyone with this URL can edit the response.

 function getEditUrl(responseId) {
  var form = FormApp.getActiveForm();
  var response = form.getResponse(responseId);
  return response.getEditResponseUrl()  
}


来源:https://stackoverflow.com/questions/48368843/retrieving-the-link-to-a-response-from-a-google-form

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!