Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

258
Views
How can I hide rows in more than one Sheet using Apps Script?

I have been creating a complex spreadhseet on Google sheets that uses data from one 'tab' to populate information in other 'tabs'.

The way I have done this leaves gaps in the tables in the other 'tabs' and therefore I would like to be able to hide all of the rows that have gaps, in all of those specific 'tabs'.

/** @OnlyCurrentDoc */

function onOpen() {
  SpreadsheetApp.getUi().createMenu("Custom Filter")
    .addItem("Filter rows", "filterRows")
    .addItem("Show all rows", "showAllRows")
    .addToUi();
}

function filterRows() {
  var sheet = SpreadsheetApp.getActive().getSheetByName("Jordan"); //Here, I need to find a way to specify more than one sheet
  var data = sheet.getDataRange().getValues();
  for(var i = 5; i < data.length; i++) {
    //If column B is blank then hide the row.
    if(data[i][1] === "") {
      sheet.hideRows(i + 1);
    }
  }
}

function showAllRows() {
  var sheet = SpreadsheetApp.getActive().getSheetByName("Jordan");
  sheet.showRows(1, sheet.getMaxRows());
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!