Skip to content

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

Change these values

Make the code yours before you run it.
Sheet name
Options

The tab holding your dropdown values in column A.

Form id
REPLACE_WITH_FORM_ID

Copy from the Google Form edit URL between /forms/d/ and /edit.

Question title
Department

Must 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.

Code.gs
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

  1. Add three test options in the Sheet

    On the Options tab, put a header in A1 and three short test labels in A2:A4.

  2. 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.

  3. Run once and approve access

    Select updateFormDropdownFromSheet beside Run and click Run. Approve access to Google Sheets and Google Forms when prompted.

  4. 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

Keep going