Returns a range of cells by A1 notation or row and column numbers.
class SpreadsheetApp method .getRange()
SpreadsheetApp is the Apps Script service.
.getRange() is the method name you will see after a dot in your code.
What it does
Why it's used
- Target a specific block of cells like B2:D50 for reading or formatting.
- The starting point for almost any cell read, write, or style change.
Common errors
- Forgetting parentheses on getRange. Write SpreadsheetApp.getRange(), not SpreadsheetApp.getRange or getRange by itself.
- Skipping dots between chained calls. Each step needs a dot, like SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Data').getRange().
- Adding spaces where they do not belong. Write SpreadsheetApp.getRange(), not SpreadsheetApp .getRange(), SpreadsheetApp.getRange (), or SpreadsheetApp . getRange().
- Wrong capitalization. Use SpreadsheetApp and getRange, not spreadsheetapp or getrange.
Snippets using this method
- Automatically Copy Spreadsheet Tab to New File with Values Only, No Formulas
- Automatically Uncheck A Daily Checklist
- Basic CRM - Add a Powerful Script To Move Row Based on Status
- Automatically Check Past Stages
- Automate Move Blank Rows
- Automatically Align Top
- Automatically Clear Content | Refresh Reuse Recycle Templates
- Automate Form Response to Confirmation Email
- Automate Google Sheets With Zero Experience
- Automate Help Desk Ticket Closing
- Automatic Calculations
- Automated Project Management in Google Sheets
- Anika Asks: How To Set Text Overflow All The Time
- Add Tasks to Google Tasks From Google Sheets
- Add NPS to Your Google Site
- Add Click Tracking To Your Google Sheets | Bitly in a Google Sheet
- Access the Dictionary API to get Definitions for Words in Google Sheets
- 2 New Ways To Add Emoji Reactions
- 5 Ways To Use Google Sheets for Advanced Project Management
- 2 New Ways To Add Emoji Reactions
Explore
Related methods
-
.getA1Notation()
Returns the A1-style address of a range, like B2:D10.
-
.getRow()
Returns the starting row index of a range.
-
.getColumn()
Returns the starting column index of a range.
-
.getDataRange()
Returns the smallest range that contains all data on the sheet.
-
.offset()
Returns a range shifted by a number of rows and columns.
More Apps Script
Better Sheets tutorials
2 New Ways To Add Emoji Reactions
Access the Dictionary API to get Definitions for Words in Google Sheets
Add Click Tracking To Your Google Sheets | Bitly in a Google Sheet
Add NPS to Your Google Site
Add Tasks to Google Tasks From Google Sheets
Anika Asks: How To Set Text Overflow All The Time
Automated Project Management in Google Sheets
Automate Emails
Automate Form Response to Confirmation Email
Automate Google Sheets With Zero Experience
Automate Move Blank Rows
Automatically Align Top
Automatically Check Past Stages
Automatically Clear Content | Refresh Reuse Recycle Templates
Automatically Copy Spreadsheet Tab to New File with Values Only, No Formulas
Automatically Uncheck A Daily Checklist
Basic CRM - Add a Powerful Script To Move Row Based on Status
Related blog posts
Written guides about SpreadsheetApp.getRange().
How to reference a different Google Spreadsheet in Apps Script?
Transferring Data Between Cells in Different Spreadsheets
Read post →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 →Getting Started Coding in Apps Script
What you need to know to access Apps Script inside Google Sheets. Code in Google Scripts. Automate business processes and more.
Read post →