Returns every sheet tab in the spreadsheet.
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
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.
2 Snippets using this methods
Explore
Related methods
-
.getActiveSheet()
Returns the sheet tab the user is viewing right now.
-
.getSheetByName()
Finds a sheet tab by its name.
-
.insertSheet()
Adds a new sheet tab to the spreadsheet.
-
.deleteSheet()
Removes a sheet tab from the spreadsheet.
-
.getActiveSpreadsheet()
Returns the spreadsheet the user currently has open.
More Apps Script
3 Better Sheets tutorials
Automate Emails
Automatically Delete All Sheets If Not Listed Name
Related blog posts
Written guides about SpreadsheetApp.getSheets().
What's Better Than Google Sheets?
Nothing is better than Google Sheets. You just need to learn more about the unlimited power of Google Sheets. Functions, Formulas, Apps Script and more.
Read post →How to Use Google Sheets as a Website Database
Did you know you can use Google Apps Script to turn a Google Sheet into a free, auto-syncing database for your website? This guide shows you exactly how to set it up. You’ll prepare your spreadsheet, write a few lines of code and publish your site. Don’t worry if you’re not a developer, we’ll walk you through it. Why Use Google Sheets as a Database? For small projects, Google Sheets offers many advantages over traditional databases: * Free hosting and storage * Easy to edit data without...
Read post →Get Sheet Done: Start Your Business in Sheets
4 Ways Google Sheets Can Help You Start Up Create a list Curate Links Track Something Write Code
Read post →