以前,我每周使用 Google Apps 脚本填充 Google 表单中下拉列表问题的选项。一道题同时有多达3600个选择。本周,当以减少的选择数量(大约 2000 个)运行相同的脚本时,我通过 script.google.com 收到以下错误:“无法设置选择。您超出了最大选择数量。” 可添加的选项数量是否有新的限制?我在网络上找不到列出的任何地方。
重现问题的代码片段:
var sheetUrl = 'https://docs.google.com/spreadsheets/d/xxxxxxxxxxxxxxxxxxxxx/edit';
var sheet = SpreadsheetApp.openByUrl(sheetUrl).getSheetByName("Form Responses 1");
var data = sheet.getDataRange().getValues();
var formExample = FormApp.openById('xxxxxxxxxxxxxxxxxxxxxxxxxx');
var listOfCustomers= formExample.getItemById(1234567890);
var customerChoices = [];
for (var i = 0; i < data.length; i+=1){
customerChoices.push(listOfCustomers.asListItem().createChoice(data[i][0]));
}
listOfCustomers.asListItem().setChoices(customerChoices);
Run Code Online (Sandbox Code Playgroud)