我想通过使用Google Apps脚本导入电子表格来进行Google表单测验。 我要替换“单元格A2”->电子表格的A2和“单元格B2-> Spreadseet的B2”。 请帮我。
var item25 = form.addMultipleChoiceItem();
item25.setTitle('Cell A2')
item25.setChoices([
item25.createChoice('Cell B2'),
item25.createChoice('Cell B2')
])
答案 0 :(得分:1)
示例:
var sheet = SpreadsheetApp.openById("paste here the id").getSheetByName("Sheet1");
var value1 = sheetgetRange("A1").getValue();
var value2 = sheetgetRange("B2").getValue();
var item25 = form.addMultipleChoiceItem();
item25.setTitle(value1)
item25.setChoices([
item25.createChoice(value2),
item25.createChoice(value2)
])