0

So this is the code that I'm using for the script that I found;

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

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

But I want it to hide the row if column D is X OR Y. I am not a programmer, and I'm very new to this. I have googled this to death but I'm not making any headway. Please help.

1 Answer 1

1

Try changing

if (r[0] == 'X') 

to

if (r[0] == 'X' || r[0] == 'Y' ) 
1
  • That did it. Thank you so much!
    – Ron
    Jul 17, 2019 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.