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());

    .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


Try changing

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


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

Your Answer

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

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