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

3 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.

Related blog posts

Written guides about SpreadsheetApp.getSheets().

Browse the blog