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

132
Views
Run This Script On Every Tab Except "Main" Tab

I have this script working well, but I'm uncertain how to make it run on every tab not labeled "Main". Thanks in advance!

function hideRows() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = ss.getSheetByName("Dude");       // Enter sheet name

var row = s.getRange('A2:A').getValues();  // Enter column letter that has the text "hide" and  "unhide"
var cell = s.getRange('A1').getValue();

s.showRows(1, s.getMaxRows());
for(var i=0; i < row.length; i++){ if(row[i] != cell) { s.hideRows(i+2, 1); }   // Value to hide
     
}
}

Jerome

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Run on every sheet except Main

I assume that you are running the onEdit trigger.

function hideRows(e) {
  const s = e.range.getSheet();
  if(s.getName() == "Main") return;
  var row = s.getRange(2,1,s.getLastRow() -1 ).getValues().flat();
  var cell = s.getRange('A1').getValue();
  s.showRows(1, s.getLastRow());
  for (var i = 0; i < row.length; i++) {
    if (row[i] != cell) { s.hideRows(i + 2, 1); }
  }
}

Want to exclude more sheets

function hideRows(e) {
  const s = e.range.getSheet();
  const ex = ['Main','Sheetx'];//excluded sheet names
  const idx = ex.indexOf(s.getName());
  if(~idx) return;
  var row = s.getRange(2,1,s.getLastRow() -1 ).getValues().flat();
  var cell = s.getRange('A1').getValue();
  s.showRows(1, s.getLastRow());
  for (var i = 0; i < row.length; i++) {
    if (row[i] != cell) { s.hideRows(i + 2, 1); }
  }
}
about 4 years ago · Juan Pablo Isaza Report
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!