简体   繁体   English

如何将谷歌表格中的信息提取到 forms 中的下拉菜单中,该下拉菜单将每分钟更新一次

[英]How do I pull over info from google sheets into a dropdown menu in forms that will update itself every minute

I am setting up a trivia game through google sheets/forms.我正在通过谷歌表格/表格设置一个琐事游戏。 I have a google form that makes a team enter in their team name and submit.我有一个谷歌表单,可以让团队输入他们的团队名称并提交。 This then goes back to a google sheet with time stamps.然后这会回到带有时间戳的谷歌表。 I want these responses to then be pulled into a drop down menu for my next 18 questions of trivia through google forms.我希望通过谷歌 forms 将这些回复拉到我接下来的 18 个琐事问题的下拉菜单中。 Using the form ranger in google forms it will only update every hour or manually.使用谷歌 forms 中的表单游侠,它只会每小时或手动更新一次。 I am trying to write a code that will update itself every minute or so.我正在尝试编写一个每分钟左右更新一次的代码。

Write this code in Google Apps Script在 Google Apps 脚本中编写此代码

function changeForm() {
  var form = FormApp.openById("enter your form id here");
  var items = form.getItems();
  //get form id from inspect element at <input id=???>
  var question1 = form.getItemById('question id').asListItem();
  var ss = SpreadsheetApp.openById("your sheet id");
  var sheet = ss.getSheetByName("Form Responses 1");
  var row = sheet.getLastRow();
  var answer = sheet.getRange(1, 2, row).getValues(); //range of answer
  question1.setTitle("title")
           .setRequired(true) //true or false
           .setChoiceValues(answer);
}

Then, save your project and go to Your project in Google Apps Script .然后,将您的项目和 go 保存到Google Apps Script 中的您的项目中

Click at your project.单击您的项目。

Click three dots button, and choose "Triggers".单击三个点按钮,然后选择“触发器”。

Click "Add Trigger".单击“添加触发器”。

Set your function name.设置您的 function 名称。

Set "Select event source" is "Time-driven"设置“选择事件源”为“时间驱动”

Set your time to trigger设置触发时间

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何向从谷歌表格的下拉菜单中选择的地址发送电子邮件? - How do I send an email to an address that is chosen from a dropdown menu in google sheets? 如何根据 Google Forms 下拉值更新字段? - How do I update fields based on a Google Forms dropdown value? 将信息从 Google 表单自动填充到表格 - Autofilling info from Google Forms to Sheets 如何从工作表的Google表单中创建链接的动态下拉菜单 - How to create dynamic dropdown linked in google Forms from sheets 如何让谷歌电子表格每 1 分钟刷新一次? - How to make google spreadsheet refresh itself every 1 minute? 如何在Google表格/表格中修改表单提交的响应? - How do I edit the response of a form submission in Google Forms/Sheets? 如何让 Google 表格每 60 秒刷新一次? - How do I make Google Sheets refresh every 60 seconds? 如何将数据从Patreon提取到Google表格中 - How to pull data from Patreon into Google Sheets 我可以使用 Google 表格中的下拉菜单或多项选择选项制作动态表单吗? - Can I make dynamic forms with dropdown or multiple choice options from Google sheets? 在Google表格中,使用脚本,如何仅更新从API调用获得的新记录? - In Google Sheets, with scripts, how do I only update new records that I get from an API call?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM