似乎您不能按组限制对表单的访问,但是当您填充表单时可以检查访问者是否在组中吗?我的工具中有一个从电子表格填充的下拉菜单,我想知道表单在填充该下拉菜单之前是否可以检查谁在尝试访问它。
代码,因为问题需要代码(除了我砍掉了ID以外,所有这些工作都有效):
// call your form and connect to the drop-down item
var form = FormApp.openById("1JMfe31jHE4R8StPy");
var namesList = form.getItemById("18500").asListItem();
// identify the sheet where the data resides needed to populate the drop-down
var ss = SpreadsheetApp.openById('1zV0cUzUg0mMM');
var names = ss.getSheetByName("Input");
// grab the values in the first column of the sheet - use 2 to skip header row
var namesValues = names.getRange("F3:F11").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);
// grab the values in the first column of the sheet - use 2 to skip header row
var namesValues = names.getRange("A29:A45").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 = form.getItemById("781187400").asListItem();
namesList.setChoiceValues(studentNames);
}