0
votes

I have a spreadsheet with date's (Months) I'm looking for a script that hides and unhide's rows automatically.

In column "Z" is a formula (=IF(A3=TODAY();"";"1")) So the cells containing "1" has to hide the row and the empty cells should unhide the row.

Can anyone help me? I have seen a lot of forums with no result for me :(

See the example below!

Example

1

1 Answers

0
votes
function hideShow() {
  var ss=SpreadsheetApp.getActive();
  var sh=ss.getActiveSheet();
  var rg=sh.getRange(3,26,sh.getLastRow()-2,1);
  var vA=rg.getValues();
  for(var i=0;i<vA.length;i++) {
    if(vA[i][0]==1) {
      sh.hideRows(i+3);
    }
    if(vA[i][0]==0) {
      sh.showRows(i+3);
    }
  }
}