I have set up an item on my Google Form to set list based on values from a Google spreadsheet, code is:
function updateForm(){
var form = FormApp.openById("FormID");
var namesList = form.getItemById("ItemID").asListItem();
var ss = SpreadsheetApp.getActive();
var names = ss.getSheetByName("SourceSheetName");
var namesValues = names.getRange(2, 1, names.getMaxRows() - 1).getValues();
var List = [];
for(var i = 0; i < namesValues.length; i++)
if(namesValues[i][0] != "")
List[i] = namesValues[i][0];
namesList.setChoiceValues(List);
}
This works perfectly fine.
What I really want is to set each of the items listed on a spreadsheet to take you to a specific section on the Google Form.
I know this can be done manually on the Google Form by using 'Go To Section Based On Answer', but I was wondering if I can add a second column on the source spreadsheet to list the sections and amend my code accordingly?
EDIT - this is not a duplicate to another question which is mentioned below. The question asked previously had 2x choices set in the code. My question involves a set of responses set in a Googlesheet that auto populates the Google Form. What I really want is to auto set Go To Section Based on Answer automatically too. I hope this makes sense. Thanks