Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"make this a quiz" and create answer key using FormApp in google spreadsheet script

I wrote a google spreadsheet script that parses a spreadsheet and creates a form with the data.

Once the form is created, I can manually go to the form settings -> Quizzes and then "make this a quiz". Once I make it a quiz, I can manually assign points and a correct answer to each problem.

Does anyone know a way to script this when creating the form? Specifically, in my google spreadsheet, my script uses FormApp to create the form and add questions. When the script creates the form, I want to add the setting "make this a quiz", and when the script creates each questions, I want to set the answer key and assign point values. I am not sure this ability exist as I could not find it in the FormApp class.

Thank you

like image 763
Peter at MUIC Avatar asked Nov 08 '22 11:11

Peter at MUIC


1 Answers

On April 27, 2017, Google added many new Google Script methods for handling Forms. The announcement is on the G Suite Developers Blog: Create Quizzes in Google Forms with Apps Scripts Among the additions is the isQuiz() function, which allows you to set the form as a quiz. The documentation (although very brief) is at the Google Developers site. The Developers Blog has a detailed explanation (with sample code) of how to create a quiz using Apps Script.

like image 184
Ike Avatar answered Nov 14 '22 22:11

Ike