Created
June 2, 2023 16:37
-
-
Save bfodeke/97bac4031a75f77a8a27139065c533c0 to your computer and use it in GitHub Desktop.
AppsScript to create google form programmatically. You will still need to connect the form to an existing sheet or create a new spreadsheet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createForm() { | |
// Create a new Form. | |
var form = FormApp.create('Issue Priority Assessment'); | |
var questions = [ | |
{ | |
title: 'Issue Impact', | |
options: [ | |
'No impact on production today', | |
'Partial impact on production today', | |
'Complete failure of a function or feature' | |
] | |
}, | |
{ | |
title: 'Data Risk', | |
options: [ | |
'No risk of data loss or compromise', | |
'Possible risk of data loss or compromise', | |
'High risk of data loss or compromise' | |
] | |
}, | |
// ... Other questions | |
]; | |
for (var i = 0; i < questions.length; i++) { | |
var question = form.addMultipleChoiceItem(); | |
question.setTitle(questions[i].title); | |
var choices = []; | |
for (var j = 0; j < questions[i].options.length; j++) { | |
choices.push(question.createChoice(questions[i].options[j])); | |
} | |
question.setChoices(choices); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment