How do I change this dynamic dependent dropdown list script so it works with my particular Google Sheet.
function onEdit(){
var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var datass = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Dropdown database")
var activeCell = ss.getActiveCell();
if(activeCell.getColumn() == 2 && activeCell.getRow() > 1){
activeCell.offset(0, 1).clearContent().clearDataValidations();
var makes = datass.getRange(1, 1, 1, datass.getLastColumn()).getValues();
var makeIndex = makes[0].indexOf(activeCell.getValue()) + 1;
if(makeIndex != 0) {
var validationRange = datass.getRange(2, makeIndex, datass.getLastRow());
var validationRule = SpreadsheetApp.newDataValidation().requireValueInRange(validationRange).build();
activeCell.offset(0, 1).setDataValidation(validationRule);
}
}
}
I found this script from a solution posted here: https://support.google.com/docs/thread/61515090/help-with-dynamic-dependent-dropdown?hl=en
I put this script into my sheet but I am not sure what I need to change on it to make it work in mine. I can see I need to change the name of the sheet "Dropdown database" to "GS" to work for my sheet, but I am not sure what else I need to change. The aim is to get the dropdown options in column B to change depending on what is selected from a dropdown in column A. I need to be able to insert rows in this sheet as well and for the script to still work.
Here is a link to my sheet. https://docs.google.com/spreadsheets/d/1xbt-7JTYmkPr0Wo0DnyjacQPnTya2y4Vx48IhS1Jh6A/edit?usp=sharing