I am trying to use the below script to automatically change checkboxes to false.
It works fine but….
I now need to apply this ONLY to the sheet titled ‘TASKS’, and not to any others within the spreadhsheet.
Can anyone assist?
image – https://i.stack.imgur.com/2cUzh.jpg
***this is also my first ever javascript attempt.
previous to this, i did some myspace tamporing 15 – 20 years ago
>Solution :
Will this modified script bring your expected result?
Modified script:
function resetCheckboxes() {
const sh = SpreadsheetApp.getActive();
const sheet = sh.getSheetByName("TASKS");
const range = sheet.getRange('B1:B11');
range.uncheck();
// or sh.getSheetByName("TASKS").getRange('B1:B11').uncheck();
}
- When this script is run, the checkboxes of "B1:B11" of "TASKS" sheet are unchecked.
- In this case, in order to retrieve the specific sheet,
getSheetByNameof Class Spreadsheet is used. - In order to uncheck the checkbox,
uncheck()of Class Range can be used.