Makes a sheet or range the active selection.
class SpreadsheetApp method .activate()
SpreadsheetApp is the Apps Script service.
.activate() is the method name you will see after a dot in your code.
What it does
Why it's used
- Jump the user to the results tab after a long script finishes.
- Highlight the row that failed validation so they can fix it.
Common errors
- Forgetting parentheses on activate. Write SpreadsheetApp.activate(), not SpreadsheetApp.activate or activate by itself.
- Skipping dots between chained calls. Each step needs a dot, like SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Data').activate().
- Adding spaces where they do not belong. Write SpreadsheetApp.activate(), not SpreadsheetApp .activate(), SpreadsheetApp.activate (), or SpreadsheetApp . activate().
- Wrong capitalization. Use SpreadsheetApp and activate, not spreadsheetapp or activate.
Snippets using this method
- Visicalc 2023 Design Walkthrough
- Visicalc 2023 Quick Walkthrough
- Show Sheet Tabs Based on Edit
- Make a Tour of Your Sheet
- Open Spreadsheet to Motivational Quote Automatically
- How to Trigger Macros Daily
- Google Maps Scraper for Outreach
- Go to Specific Cell When Spreadsheet is Opened
- ChatGPT Clone in Google Sheets Part 2
- Americano Tournament Template With Four Automations
- Activate A Certain Sheet When Opening a Spreadsheet
Explore
Related methods
-
.getActive()
Returns the range the user currently has selected.
-
.getActiveSpreadsheet()
Returns the spreadsheet the user currently has open.
-
.insertSheet()
Adds a new sheet tab to the spreadsheet.
-
.clear()
Removes values, formatting, and notes from a range.
-
.getActiveSheet()
Returns the sheet tab the user is viewing right now.
More Apps Script
Better Sheets tutorials
Activate A Certain Sheet When Opening a Spreadsheet
Americano Tournament Template With Four Automations
ChatGPT Clone in Google Sheets Part 2
Google Maps Scraper for Outreach
Go to Specific Cell When Spreadsheet is Opened
Make a Tour of Your Sheet
Show Sheet Tabs Based on Edit
Visicalc 2023 Design Walkthrough
Related blog posts
Written guides about SpreadsheetApp.activate().
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 →Explore Coding in Google Sheets
Did you know you can actually code in Google Sheets?
Read post →How to reference a different Google Spreadsheet in Apps Script?
Transferring Data Between Cells in Different Spreadsheets
Read post →