class SpreadsheetApp method .getSheets()

SpreadsheetApp is the Apps Script service.

.getSheets() is the method name you will see after a dot in your code.

What it does

Returns every sheet tab in the spreadsheet.

Why it's used

  • Loop through every tab to hide old months or refresh all of them.
  • Count or list sheets when building an admin cleanup tool.

Common errors

  • Forgetting parentheses on getSheets. Write SpreadsheetApp.getSheets(), not SpreadsheetApp.getSheets or getSheets by itself.
  • Skipping dots between chained calls. Each step needs a dot, like SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Data').getSheets().
  • Adding spaces where they do not belong. Write SpreadsheetApp.getSheets(), not SpreadsheetApp .getSheets(), SpreadsheetApp.getSheets (), or SpreadsheetApp . getSheets().
  • Wrong capitalization. Use SpreadsheetApp and getSheets, not spreadsheetapp or getsheets.

Explore

Related methods

Better Sheets tutorials

Automate Emails

Automate Emails

Set up automated email notifications based on Google Sheets data. Super ...
Automatically Delete All Sheets If Not Listed Name

Automatically Delete All Sheets If Not Listed Name

A raw, 1 shot take of figuring out how to automatically delete all sheet...
Automatic Calculations

Automatic Calculations

Create custom scripts to make your spreadsheets more like tools.
Brighten Up Your Checklist Automatically

Brighten Up Your Checklist Automatically

Create a cool function that brightens your sheet background from white t...
Create Navigation Like A Book or Presentation

Create Navigation Like A Book or Presentation

A pretty cool script I came up with to click and set active the next tab...
Curate Google Sheets Easily - Automatic Bookmarklet Maker

Curate Google Sheets Easily - Automatic Bookmarklet Maker

Curated sites, articles, and more web resources super easily into a Goog...
Different Kinds of Automation

Different Kinds of Automation

A brief description of types of automation. I go way more in depth in “M...
How To Download All Tabs as CSV in a Zip File

How To Download All Tabs as CSV in a Zip File

Download All Tabs as CSV in a Zip File, instead of downloading each one ...
How To Duplicate a Tab and Move it to the End in Google Sheets

How To Duplicate a Tab and Move it to the End in Google Sheets

Learn how to automate creating a template and moving the tab to the far ...
How to Move Tab To End Easily with Apps Script

How to Move Tab To End Easily with Apps Script

Create an apps script to move active tab to the far right.
How to Power Testimonials with Google Forms and Sheets

How to Power Testimonials with Google Forms and Sheets

I show you how I use a Google Form and a Google Sheet to power the testi...
Introducing SheetFools

Introducing SheetFools

Free google sheets automations pranks you can use right now. Launching p...
Make a Tour of Your Sheet

Make a Tour of Your Sheet

create a tour of your sheet for users who might be using your sheet and ...
Twitter App Clone in a Google Sheet

Twitter App Clone in a Google Sheet

I built a twitter clone in Google Sheets

Related blog posts

Written guides about SpreadsheetApp.getSheets().

Browse the blog