使用Google Apps Script在Google表单中设置正确答案(已被定义为测验)



我试图使用谷歌应用程序脚本设置正确的答案在谷歌表单(已被定义为测验)

实际的Google Form可以使用如下代码定义:
var form = FormApp.create('New Form');
var item = form.addCheckboxItem();
item.setTitle('What condiments would you like on your hot dog?');
item.setChoices([
        item.createChoice('Ketchup'),
        item.createChoice('Mustard'),
        item.createChoice('Relish')
    ]);

(取自https://developers.google.com/apps-script/reference/forms/)

是否有任何方法在代码中定义实际正确答案是什么并分配给它点?

更新:2017年4月,谷歌宣布现在可以通过编程方式创建谷歌表单测验。


此时没有办法设置正确答案。第6143期:通过API创建测验表格

Copy

6.// Make a 10 point question and set up the question
7.    const item = form.addCheckboxItem();
8.    item.setTitle("What flavors are in neapolitan ice cream?");
9.    item.setPoints(10);
11.// chocolate, vanilla, & strawberry are the correct answers
12.   item.setChoices([
13.     item.createChoice("chocolate", true),
14.     item.createChoice("vanilla", true),
15.     item.createChoice("rum raisin", false),
16.     item.createChoice("strawberry", true),
17.     item.createChoice("mint", false)
18.   ]);

相关内容

最新更新