【问题标题】:How to retrieve the link to a response from a Google Form如何从 Google 表单中检索到响应的链接
【发布时间】:2021-08-19 12:29:53
【问题描述】:

我想直接链接到个人回复(链接看起来像 https://docs.google.com/forms/d//edit#response=)并将其粘贴到文件 google 电子表格中。如何检索该链接?我使用 Form.getEditUrl() 获得了指向 /edit 的部分链接,但我无法获得正确的 ID。我检查了 FormResponse.getId() 但这并没有将我链接到任何响应。以下是如何通过编辑表单手动访问该链接: enter image description here

非常感谢:(

【问题讨论】:

  • 您能否更好地解释您的问题?见how to ask

标签: google-apps-script google-forms


【解决方案1】:

从表单的脚本编辑器运行。

function getUrls() {
  const name = 'Sheet Name'; // name of sheet
  const col = 10; // the column number to fill
  const form = FormApp.getActiveForm();
  const formResponses = form.getResponses();
  const values = [];
  for (const r of formResponses) {
    values.push([r.getEditResponseUrl()]);
  }
  const id = form.getDestinationId();
  const ss = SpreadsheetApp.openById(id);
  const sheet = ss.getSheetByName(name);
  sheet.getRange(2, col, values.length, 1).setValues(values);
}

【讨论】:

  • 谢谢。但它没有效果。语句“TypeError: Cannot read property 'getResponses' of null (Line 5, "Code.gs")”你能帮帮我吗?
  • 哦,我试过了。它是显示编辑 url 响应。我不需要它们。我只想要 url 响应(包括学生测试的真/假问题)(例如:prnt.sc/1qc4hyu
  • 我认为这是目前获取 Google 表单各个响应的 url 的唯一方法。您可能需要开发一个网络应用程序/使用模式来显示只读响应。
  • 或者,您可以为充当假人的响应生成预填充链接
猜你喜欢
  • 2018-06-30
  • 2023-04-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-15
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多