[英]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.