I’ve been trying so hard to understand javascript as I know only Python.
I generate javascript codes using Python, to run it on Google Scripts.
I was able to automate creation of any number of Multiple Choice Items by generating codes to be used as script, but I could not figure out how to make a script for Identification Questions (by Identification means answers to questions will be in words). I could make TextItem, but could not “put” the answer to it.
function myFunction() { var form = FormApp.openById('xxx'); form.setTitle('title') .setDescription('description') .setIsQuiz(true) .setLimitOneResponsePerUser(true) ; var item = form.addMultipleChoiceItem(); item.setTitle('This is a MultiChoice question.') .setChoices([ item.createChoice('option'), item.createChoice('answer', true), item.createChoice('option2'), ]) .setPoints(1) .setRequired(true) ; var item = form.addTextItem(); item.setTitle('What is the capital of Japan?') .setPoints(1) .setRequired(true) var itemresponse = item.createResponse('Tokyo') ; }
Advertisement
Answer
Assigning correct answers to text items cannot be achieved programmatically
It is a popular feature request (see https://issuetracker.google.com/117437423 and https://issuetracker.google.com/71637498), but has not been implemented so far.
Unfortunately you cannot do much about it apart from “starring” the issues to give them more visibility and / or changing your questions to multiple choice.