Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How do I Apply checkbox reset to only one sheet

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>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, getSheetByName of Class Spreadsheet is used.
  • In order to uncheck the checkbox, uncheck() of Class Range can be used.

References:

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading