Below is my script or code:

function myFunction() {

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

    .forEach( function (r, i) {
    if (r[0] == 'Complete') 
      s.hideRows(i + 1);

I would like this script to work on multiple tabs such as Sheet2, Sheet3, etc.

I have looked all over for a script that would work with mine to make it work on multiple tabs. If you know how to do this, please help!

1 Answer 1



var s = SpreadsheetApp.getActive().getSheetByName('Sheet1');


var s = SpreadsheetApp.getActiveSheet();

The above line will assign the sheet that was edited to s.

  • You, Sir, are a genius!! THANK YOU Jan 11, 2019 at 19:10

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.