[英]Google Form Drop Down List From a Google Sheet
我不確定為什么,但是此Google腳本無法運行...我錯過了什么嗎? 應該只是從Google工作表中的列表中提取的Google表單中的直接下拉列表。 謝謝!
function updateForm(){
// call your form and connect to the drop-down item
var form = FormApp.openById("1jkvyqmRwK_U9Ddn96LRRAxC0xjnuufo3JuIj9kszNQ8");
var namesList = form.getItemById("1425039677").asListItem();
// identify the sheet where the data resides needed to populate the drop-down
var ss = SpreadsheetApp.getActive();
var names = ss.getSheetByName("Student Names");
// grab the values in the first column of the sheet - use 2 to skip header row
var namesValues = names.getRange(2, 1, names.getMaxRows() - 1).getValues();
var studentNames = [];
// convert the array ignoring empty cells
for(var i = 0; i < namesValues.length; i++)
if(namesValues[i][0] != "")
studentNames[i] = namesValues[i][0];
// populate the drop-down with the array data
namesList.setChoiceValues(studentNames);
當我運行它時,它說的一切就是准備執行,然后什么也沒有。
看起來這確實有效。 我按照@Cooper的建議關閉了表格和表格,然后重新啟動,這似乎可以解決問題。 謝謝!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.