So, this goal seemed simple at first, but I can't seem to wrap my head around how to accomplish it.
I have these independent dropdowns, with between 3 to 4 dependent dropdowns associated with each independent. I would like to be able to apply the associated dependent dropdowns when the independent dropdown is selected.
Example: Dropdowns in Column A have 3-4 variables associated with them (https://docs.google.com/spreadsheets/d/1ErRBqfEeRqTNLIH0N11IjViP-_ej1LMdrOXNvDOcsx8/edit?usp=sharing)
In the following code, I can apply 1 independent, and 1 dependent, but I can't figure out how to scale it to my needs:
function onEdit(){
var tabLists = "Lists";
var spreadsheet = SpreadsheetApp;
var activeSheet = spreadsheet.getActiveSpreadsheet().getActiveSheet();
var data = spreadsheet.getActiveSpreadsheet().getSheetByName(tabLists);
var activeCell = activeSheet.getActiveCell();
if(activeCell.getColumn() == 1 && activeCell.getRow() > 1 && activeSheet.getSheetName().includes("Programming")){
activeCell.offset(0, 1).clearDataValidations(); //Clears data validation 1 column over
var exerciseCat = data.getRange(1, 1, 1, data.getLastColumn()).getValues();
var catIndex = exerciseCat[0].indexOf(activeCell.getValue()) + 1;
if(catIndex != 0){
var validationRange = data.getRange(3, catIndex, data.getLastRow());
var validationRule = spreadsheet.newDataValidation().requireValueInRange(validationRange).build();
activeCell.offset(0, 1).setDataValidation(validationRule);
}
}
}
I thought that maybe my answer existed within making a 4-level dependent dropdown, but that didn't work either.
All help is greatly appreciated, as I am still quite new to any form of coding.