mardi 22 janvier 2019

Google Sheets Script to Hide Row if Checkbox Checked

I am trying to find a working code that will automatically hide a row if the checkbox in column F of that row is checked.

I have tried every script I have found and nothing seems to work. Unfortunately I am not code savvy and I am unable to find the issue.

This is what I currently have:

function onOpen() {
  var s = SpreadsheetApp.getActive().getSheetByName("Checklists");
  s.showRows(1, s.getMaxRows());

  s.getRange('F2:F200')
    .getValues()
    .forEach( function (r, i) {
    if (r[0] == "TRUE") 
      s.hideRows(i + 1);
    });
}

The sheet I am working on is "Checklists" and the column that contains the checkbox is F. The value of the checkbox is either TRUE or FALSE. If the value is TRUE, I want that row to be hidden.

Can someone please help!!!




Aucun commentaire:

Enregistrer un commentaire