setChoiceValues() replaces the answer choices of a multiple choice, checkbox or dropdown question in a Google Form. You pass it an array of strings, and those strings become the new list of choices. It’s the method to use when the choices come from somewhere else, such as a list of products in a sheet or this term’s session times, and you don’t want to edit the form by hand every time the list changes.
This guide covers:
- the basic
setChoiceValues()call for a multiple choice question; - how to keep the Other option when you replace the choices;
setChoices()andcreateChoice(), for quiz answers and “go to section” choices;- checkbox and dropdown questions, including filling a dropdown from a Google Sheet;
- the errors you are most likely to hit.
The short version
function updateSessionChoices() {
const form = FormApp.getActiveForm();
const item = form.getItems(FormApp.ItemType.MULTIPLE_CHOICE)[0]
.asMultipleChoiceItem();
const hadOther = item.hasOtherOption();
item.setChoiceValues(['Morning (9:00)', 'Afternoon (14:00)', 'Evening (18:00)']);
item.showOtherOption(hadOther); // keep the "Other" option
Logger.log(item.getChoices().map(c => c.getValue()));
}This finds the first multiple choice question in the form, replaces its choices with three new ones and puts the Other option back if the question had one. The rest of this article explains each line and the variations.
Step by step: run setChoiceValues on your form
Here is the form used in the examples. It has one multiple choice question with two sessions and an Other option.

- Open the form in the editor.
- Click the ⋮ (More) menu at the top right and choose Apps Script. A script project bound to the form opens in a new tab.

- Delete the sample
myFunctionand paste the code from above. - Click the save icon, then click Run with
updateSessionChoicesselected in the function list.

- The first time you run it, Apps Script asks for permission to edit your forms. Click Review permissions, choose your account and allow access. If you see the “Google hasn’t verified this app” screen, see how to review and accept Apps Script permissions.

When the run finishes, the execution log shows the new values:

Reload the form editor. The question now lists Morning, Afternoon and Evening, followed by Other:

getActiveForm() only works in a script that is bound to the form, which is what you get from the Apps Script menu item. In a standalone script, open the form by its ID instead:
const form = FormApp.openById('YOUR_FORM_ID');The ID is the long part of the editor URL between /d/ and /edit.
What setChoiceValues does (and doesn’t do)
- It replaces the list. Every existing choice is removed and the new values take their place. To add one choice, read the current values with
getChoices(), add yours to the array and pass the whole array back. - It needs at least one value. An empty array throws an error, so check your list before you call it.
- It only sets the text. The choices it creates are plain choices. They aren’t marked as correct quiz answers, and they don’t send people to another section. For that you need
setChoices()(see below). - It leaves earlier responses alone. Answers submitted before the change stay in the Responses tab and in the linked sheet as they were.
To add a single choice without losing the others:
const values = item.getChoices().map(c => c.getValue());
if (!values.includes('Evening (18:00)')) {
values.push('Evening (18:00)');
item.setChoiceValues(values);
}Keep the “Other” option when you change choices
The Other option isn’t one of the choices in the array. It’s a separate setting on the question, controlled by two methods:
hasOtherOption()returnstrueif the question shows Other;showOtherOption(true)turns it on, andshowOtherOption(false)turns it off.
When I tested it in December 2026, setChoiceValues() left Other switched on: hasOtherOption() returned true both before and after the call. Google’s documentation doesn’t promise this, though, and its own examples call showOtherOption(true) straight after setChoiceValues(). Reading the setting first and setting it again afterwards, as the short version does, costs two lines and keeps working if the behaviour changes.
const hadOther = item.hasOtherOption();
item.setChoiceValues(newValues);
item.showOtherOption(hadOther);If the question should always have Other, chain the call:
item.setChoiceValues(newValues).showOtherOption(true);Two things to know:
- Don’t put “Other” in your array. You would get an ordinary choice called “Other” without the text box.
- Dropdown questions (
ListItem) have no Other option, and there is noshowOtherOption()on them.
Want the answers people type under Other to become real choices for the next person? That’s what this script that adds new choices from “Other” responses does, using setChoiceValues() inside an onFormSubmit trigger.
setChoices and createChoice (there is no FormApp.newChoice)
FormApp.newChoice doesn’t exist. Choices are created from the question itself with item.createChoice(), collected in an array and passed to item.setChoices(). You need this form whenever a choice needs more than its text.
Quiz questions with a correct answer
const item = form.addMultipleChoiceItem()
.setTitle('Which method replaces all choices of a question?')
.setPoints(1);
item.setChoices([
item.createChoice('setChoiceValues', true), // correct
item.createChoice('addChoiceValues', false),
item.createChoice('appendChoices', false)
]);The form must be a quiz (Settings › Make this a quiz, or form.setIsQuiz(true)) for points and correct answers to count.
Choices that go to a section
This works for multiple choice and dropdown questions, not checkboxes.
const pages = form.getItems(FormApp.ItemType.PAGE_BREAK);
const morning = pages[0].asPageBreakItem();
const afternoon = pages[1].asPageBreakItem();
item.setChoices([
item.createChoice('Morning (9:00)', morning),
item.createChoice('Afternoon (14:00)', afternoon),
item.createChoice('I can\'t come', FormApp.PageNavigationType.SUBMIT)
]);The last choice uses PageNavigationType.SUBMIT to end the form. Use navigation for all the choices in a question or for none of them. The documentation also warns against combining navigation with the Other option.
Because setChoiceValues() creates plain choices, calling it on a quiz question or a question with section jumps removes the correct answers and the jumps. Rebuild those questions with setChoices() instead.
Methods by question type
| Method | Multiple choice (MultipleChoiceItem) | Checkboxes (CheckboxItem) | Dropdown (ListItem) |
|---|---|---|---|
setChoiceValues(values) | Yes | Yes | Yes |
setChoices(choices) | Yes | Yes | Yes |
getChoices() | Yes | Yes | Yes |
createChoice(value) | Yes | Yes | Yes |
createChoice(value, isCorrect) | Yes | Yes | Yes |
createChoice(value, pageBreakItem) | Yes | No | Yes |
createChoice(value, PageNavigationType) | Yes | No | Yes |
showOtherOption() / hasOtherOption() | Yes | Yes | No |
Shuffling the order of choices isn’t available in Apps Script. The only shuffle method is form.setShuffleQuestions(), which shuffles the questions, not the choices.
Checkbox questions
CheckboxItem works the same way. Get the question with asCheckboxItem():
function updateTopics() {
const form = FormApp.getActiveForm();
const item = form.getItems(FormApp.ItemType.CHECKBOX)[0].asCheckboxItem();
const hadOther = item.hasOtherOption();
item.setChoiceValues(['Apps Script', 'Google Sheets', 'Google Forms', 'Gmail']);
item.showOtherOption(hadOther);
}Find the question by its title
getItems(...)[0] takes the first question of that type. In a form with several questions, it’s safer to find the one you want by its title:
function getItemByTitle(form, title) {
const item = form.getItems().find(i => i.getTitle() === title);
if (!item) throw new Error('No question titled "' + title + '"');
return item;
}
const item = getItemByTitle(form, 'Which session will you attend?')
.asMultipleChoiceItem();You can also use the question’s ID with form.getItemById(id), which keeps working if someone renames the question. Log item.getId() once to find it.
Fill a dropdown from a Google Sheet
The most common use of setChoiceValues() is keeping a dropdown in sync with a list in a spreadsheet. This reads column A of a sheet called Products (with a header in row 1), drops empty cells and duplicates, and writes the list to a dropdown question:
function updateProductDropdown() {
const sheet = SpreadsheetApp.openById('YOUR_SHEET_ID').getSheetByName('Products');
if (sheet.getLastRow() < 2) return; // nothing below the header
const values = sheet.getRange(2, 1, sheet.getLastRow() - 1, 1).getValues()
.map(row => String(row[0]).trim())
.filter(v => v !== '');
const unique = [...new Set(values)];
if (unique.length === 0) return; // setChoiceValues throws on an empty list
const form = FormApp.getActiveForm();
const item = form.getItems(FormApp.ItemType.LIST)[0].asListItem();
item.setChoiceValues(unique);
}To keep it up to date automatically, add a trigger in the script editor (Triggers › Add trigger): a time-driven trigger that runs every hour, for example, or run it from a script bound to the spreadsheet when the sheet is edited.
Common errors
- “Cannot read properties of undefined (reading ‘asMultipleChoiceItem’)”:
getItems(...)[0]found no question of that type. Check that the question really is a multiple choice question (a dropdown isLIST, checkboxes areCHECKBOX), or find it by title. - An error when you call setChoiceValues: the array is empty. Filter out blank values first and stop if nothing is left.
- The Other option disappeared: check that nothing else in the script calls
showOtherOption(false), then callshowOtherOption(true)aftersetChoiceValues(), as shown above. - Quiz answers or section jumps are gone:
setChoiceValues()replaced them with plain choices. UsesetChoices()withcreateChoice(value, isCorrect)or a navigation target. - “You do not have permission to call FormApp.openById”: the script is running without access to all your forms. This happens in simple triggers such as
onOpen, or when the project is limited to the current file with@OnlyCurrentDoc. Run the function from the editor or from an installable trigger, and remove@OnlyCurrentDocif the script opens other forms.
FAQ
Does setChoiceValues add to the existing choices?
No. It replaces all of them. Read the current list with getChoices(), add the new value and pass the whole array.
How do I keep the “Other” option with setChoiceValues?
Read hasOtherOption() before the call and pass the result to showOtherOption() after it, or chain .showOtherOption(true) if the question should always have Other.
What is FormApp.newChoice?
There is no such method. Create choices with item.createChoice(value) on the question you are changing and pass them to item.setChoices().
What’s the difference between setChoiceValues and setChoices?
setChoiceValues() takes plain strings. setChoices() takes Choice objects made with createChoice(), which can also carry a correct answer for quizzes or a section to go to.
Will changing the choices delete my responses?
No. Existing responses stay in the form and in the linked sheet. Only new respondents see the new choices.
Summary
Use item.setChoiceValues(array) to replace the choices of a multiple choice, checkbox or dropdown question, read hasOtherOption() first and restore it with showOtherOption() afterwards, and switch to setChoices() with createChoice() when choices need a correct answer or a section to jump to. If you’re new to the different question types, see Google Forms question types, and to act on each new answer, see how to get email notifications from Google Forms.
