First post for me.
I created a Google Form dropdown with an Apps Script that I found online that pulls the dropdown choices from another Sheet that I named “Choices”. I needed the same list as options for 2 questions so I simply “duplicated” the 1st question to create the 2nd. I don’t know why but changes to the Choices tab only show up for the 1st dropdown, not the 2nd.
I tried several things to fix this but none worked (see below).
Can someone help explain why and what I need to do to fix this?? (The AppsScript code is below). Thanks!!
function updateDropdown() {
// Get the form and the spreadsheet
var form = FormApp.openById(‘ (Link ID removed here)’;
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(‘Choices’);
// Get the data from the spreadsheet
var data = sheet.getRange(‘A:A’).getValues();
var items = data.flat().filter(String);
// Get the dropdown question in the form
var formItems = form.getItems(FormApp.ItemType.LIST);
var listItem = formItems[0].asListItem();
// Update the dropdown options
listItem.setChoiceValues(items);
}
I tried recreating the 2nd question from scratch and also move Question 2 to the top just to test and make sure the question syntax, etc wasn’t the problem. It wasn’t. When I moved #2 to the top, it picked up the changes to the list, but now #1 (now below it) didn’t.
Mark Rosen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.