I am trying to toggle multiple checkboxes in Google Sheets using one master checkbox.
I figured out separate scripts that can check or uncheck four boxes (say cells L2:L5) at once when run:
function Toggle1() {
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('L2:L5').activate();
spreadsheet.getActiveRange().setValue('TRUE');
};
function Toggle2() {
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('L2:L5').activate();
spreadsheet.getActiveRange().setValue('FALSE');
};
Is there a way to activate these based on a single checkbox placed elsewhere in the sheet, say A1? So, if A1 is checked, then L2:L5 will check. Alternatively, if A1 is unchecked, L2:L5 will uncheck.
My common sense tells me I have to use an if statement somewhere in the script. I am unclear how to do this in a script context.
Thank you for any and all help!