Web Applications Stack Exchange is a question and answer site for power users of web applications. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We are trying to link a list on a Google Spreadsheet to a drop down menu on a Google Form.

The twist is that this Google Spreadsheet list will be continuously updated and needs to automatically update the form.

I'm borrowing this code we found online:

var FORMID = "1aGrHm7x39kAJ-iJlFvp58saZHyARyB92uCbyvxGqE7M";
var LIST_DATA = [{title:"Which Document Did You Use?", sheet:"Documents"}]

function onOpen(e){
  var menuEntries = [];
  menuEntries.push({name: "Update Lists", functionName: "updateLists"});
  SpreadsheetApp.getActiveSpreadsheet().addMenu("List Updater", menuEntries)

function updateLists() {
  var form = FormApp.openById(1aGrHm7x39kAJ-iJlFvp58saZHyARyB92uCbyvxGqE7M);
  var items = form.getItems();
  for (var i = 0; i < items.length; i += 1){
    for (var j = 0; j < LIST_DATA.length; j+=1) {
    var item = items[i]
    if (item.getTitle() === LIST_DATA[i].title){
        updateListChoices(item.asListItem(), LIST_DATA[i].sheet);

function updateListChoices(item, sheetName){
  var data = (SpreadsheetApp.getActiveSpreadsheet()
  var choices = [];
  for (var i = 0; i < data.length; i+=1){

It worked for the creator but I'm having this error:

Missing ) after argument list. (line 11, file "Code")

Here is the spreadsheet in question: https://docs.google.com/spreadsheet/ccc?key=0AoFVL1CoqhmxdDE2UDRHbnBaNnAzUjVHLVFQcWQxSlE&usp=sharing#gid=0

share|improve this question
For later questions; please include the relevant code in your question, don't just link to it. If the link goes away some day, the question will be of no use. I have edited your question to include the code. – Vidar S. Ramdal Nov 12 '13 at 11:22

The line

var form = FormApp.openById(1aGrHm7x39kAJ-iJlFvp58saZHyARyB92uCbyvxGqE7M);

needs quotes around the id parameter:

var form = FormApp.openById("1aGrHm7x39kAJ-iJlFvp58saZHyARyB92uCbyvxGqE7M");

... or, use the FORMID constant you have already defined:

var form = FormApp.openById(FORMID);

Also, add a ; to terminate line 17:

var item = items[i];
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.