检索指向Google表单回复的链接 [英] Retrieving the link to a response from a Google Form

查看:104
本文介绍了检索指向Google表单回复的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Google表单上附加了一个脚本,该脚本在提交时将通知发送到Discord频道.我想包括指向各个响应的直接链接(链接看起来像https://docs.google.com/forms/d/<myformid>/edit#response=<responseid>).如何获取该链接?我通过Form.getEditUrl()获取到/edit的链接的一部分,但是我无法获得正确的ID.我检查了FormResponse.getId(),但这没有将我链接到任何响应.

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:

推荐答案

由于您知道响应ID,因此可以使用geEditResponseUrl方法获取到表单响应的直接链接.请注意,具有此URL的任何人都可以编辑响应.

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()  
}

这篇关于检索指向Google表单回复的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆