I'm new to GoogleAppsScript and now making quizzes in google form and spreadsheet by using GAS.
I want to shuffle items in a MultipleChoiceItem when the google form is reloaded.
A part of my current scirpt, slightly modified form this code, is presented below.
//vars from spreadsheet
var form = FormApp.openById(id);
var ss = SpreadsheetApp.openById(question_bank_ID);
var text = sheet.getSheetValues(questions[i]+1, 2, 1, 1)[0][0];
var options = sheet.getSheetValues(questions[i]+1, 5, 1, 5)[0];
var ans = sheet2.getSheetValues(questions[i]+1, 5, 1, 5)[0];
//MultipleChoiceItem
var mc = form.addMultipleChoiceItem().setTitle(text);
mc.setPoints(1) // set point
// add choices with isCorrect
while (options[options.length - 1] === "") {
options.pop();
}
mc.setChoices(options.map(function (options, i) {
return mc.createChoice(options, ans[i]);
}
)
)
Could someone please tell me a solution? Thanks for your help!