I am a new to Google Apps Script programming. I am trying to use a Google sheet to dynamically populate a Google Form. I have one drop down working, but when I try to add a second it just duplicates the first.
Here is my code:
//bonus, gets values from spreadsheet and returns them
function getValues() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var lastRow = sheet.getLastRow();
var range = sheet.getRange(1, 1, lastRow);
var range_team = sheet.getRange(1, 4, lastRow);
var values = range.getValues();
var values_team = range_team.getValues();
return values;
return values_team;
}
//what you'll need to call initially to create the form, and store id in project properties
function createForm() {
// create Form
var form = FormApp.create('Test Form 11_6_14_3');
// first drop down list
var values_team = getValues(1,4,3,4);
var list_team = form.addListItem();
var listItems_team = list_team.setChoiceValues(values_team);
// second drop down list
var values = getValues(1,1,1,18);
var list = form.addListItem();
var listItems = list.setChoiceValues(values);
var formId = form.getId();
PropertiesService.getScriptProperties().setProperty('Test Form 11_6_14_3', formId);
}
Thanks and be gentle...remember I'm a noob...