Task guide
Populate a Google Form dropdown from Sheets
Read a list of choices from column A of a Google Sheet and push them into a dropdown question on a Google Form, removing blank cells and duplicates first.
1 · Prepare
Put these pieces in place
- Create a Sheet tab named Options with a header in A1 and the dropdown choices in A2 downward.
- Open the Google Form in edit mode and copy its form ID from the URL between /forms/d/ and /edit.
- Confirm the exact title of the Dropdown (List) question on the form.
Change these values
- Sheet name
OptionsThe tab holding your dropdown values in column A.
- Form id
REPLACE_WITH_FORM_IDCopy from the Google Form edit URL between /forms/d/ and /edit.
- Question title
DepartmentMust match the Dropdown question title on the form.
2 · Review before running
What the script can access and change
Permissions you approve
- See, edit, create, and delete all your Google Sheets spreadsheets. The code only reads column A of the Options tab.
- View and manage your forms in Google Drive. The code replaces the choice list on the single dropdown question you named.
Effects of one run
- Replaces the choices on the matching Dropdown question with the deduplicated, non-empty values from column A.
- Leaves all other questions, existing responses, and Sheet cells unchanged.
3 · Copy
Paste this into the Apps Script editor
Create or open a script file, replace the example values marked above, then save the project.
const SHEET_NAME = 'Options'; // The tab holding your dropdown values in column A.
const FORM_ID = 'REPLACE_WITH_FORM_ID'; // Copy from the Google Form edit URL between /forms/d/ and /edit.
const QUESTION_TITLE = 'Department'; // Must match the Dropdown question title on the form.
function updateFormDropdownFromSheet() {
const spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
const sheet = spreadsheet.getSheetByName(SHEET_NAME);
if (!sheet) {
throw new Error('Add a Sheet tab named ' + SHEET_NAME + ' before running this function.');
}
const lastRow = sheet.getLastRow();
if (lastRow < 2) {
throw new Error('Add at least one choice below the header in column A.');
}
const rawValues = sheet.getRange(2, 1, lastRow - 1, 1).getValues();
const choices = Array.from(
new Set(
rawValues
.map((row) => String(row[0]).trim())
.filter((value) => value.length > 0)
)
);
if (choices.length === 0) {
throw new Error('No non-empty choices were found in column A.');
}
const form = FormApp.openById(FORM_ID);
const matchingItem = form
.getItems(FormApp.ItemType.LIST)
.find((item) => item.getTitle() === QUESTION_TITLE);
if (!matchingItem) {
throw new Error('No dropdown question titled "' + QUESTION_TITLE + '" was found on the form.');
}
matchingItem.asListItem().setChoiceValues(choices);
Logger.log('Updated "' + QUESTION_TITLE + '" with ' + choices.length + ' choices.');
} 4 · Run
Follow these steps in order
Add three test options in the Sheet
On the Options tab, put a header in A1 and three short test labels in A2:A4.
Paste the script and fill in the ID
In the Sheet, choose Extensions, then Apps Script. Replace the starter code, paste your Form ID into FORM_ID, set QUESTION_TITLE to match your dropdown question, and save.
Run once and approve access
Select updateFormDropdownFromSheet beside Run and click Run. Approve access to Google Sheets and Google Forms when prompted.
Verify the form dropdown
Open the Google Form preview and check that the dropdown lists the three choices from column A. To keep the form updated on a schedule, add a daily trigger in Triggers.
5 · Confirm
How to tell it worked
The Execution log reports how many choices were written, and the dropdown question on the Google Form lists the exact values from column A.
If the result is different
Troubleshooting
- The run stops with "No dropdown question titled ... was found on the form."
- Confirm that the question type is Dropdown (not Multiple choice) and that QUESTION_TITLE matches its exact wording and capitalization.
- FormApp.openById throws an error about permissions or a missing file.
- Copy the ID from the form edit URL (/forms/d/<ID>/edit) rather than the responder link, and confirm that your account can edit the form.
Technical details
Names used in this script
Open these details when you want to adapt the example or look up an exact service or method name.
Show Apps Script symbols and service pages
Apps Script symbols
Service pages
Keep going
Related tasks, basics, and apps
- Task guide Respond to a Google Form submission
Get an email every time someone submits your Google Form, listing each question and its answer. The email goes only to you, the owner of the script.
- Task guide Send a confirmation to the form respondent
Send each person who submits your Google Form a short thank-you email that repeats their answers. The form must collect verified email addresses.
- Task guide Create Calendar events from Form submissions
Schedule a Google Calendar event whenever someone submits a Google Form, using the title, date, and duration from the submission.
- Object reference Sheet
A Sheet is one tab inside a Google spreadsheet. Get it with getSheetByName() or getActiveSheet(). Use getLastRow() to find the last row with content, or getRange() to select cells to read.
- Object reference Form
A FormApp.Form is the Google Form itself. Get it with FormApp.getActiveForm() or openById(id). Read its questions with getItems() or count submissions with getResponses().
- Google app Google Sheets
SpreadsheetApp lets a Google Sheets script read a Sheet or Range, add a custom menu or formula, and act on each row, such as sending one email per row.
- Google app Google Forms
FormApp scripts and form-submit triggers read new Google Form responses via event.response, populate dropdown questions from Google Sheets, and trigger email or Calendar actions.
- Diagnostic TypeError: Cannot read properties of null (reading 'getRange')
Why getSheetByName() returned null when the Options tab name did not match, and how to check it.