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
- Ultimate Prompt Writer and Prompt Rater
- Uncheck Every Checkbox in Google Sheets
- Ultimate Prompt Writer and Prompt Rater
- Upgrade Google Sheets OpenAI Prompt to GPT 4
- Visicalc 2023 Design Walkthrough
- Visicalc 2023 Quick Walkthrough
- Tweet From a Sheet
- Send a Button from Google Sheets in an Email
- SubSpyHub Subreddit Scanner
- Simple Inventory Management Automations
- Sync Tabs in Different Sections
- Sync Many Tabs without ImportRange()
- Timestamp When Done (With Code)
- Spreadsheet Automation for Beginners
- Shaman: AI Blog Writer
- Spreadsheet Automation for Beginners
- Shaman: AI Blog Writer
- Shaman: AI Blog Writer
- SOLUTIONS! Solve The Errors, Learn For Loop
- Tag Emails From A List of Members in Google Sheets
- Twitter App Clone in a Google Sheet
- Sync Two Tabs Without ImportRange()
- Send a Daily Email with Inspiring Quote - A Little Pick Me Up
- Track Every Edit (Almost)
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
Bjarne Asks: Can I show the Last Time of the Last Edit in a sheet?
Breaking Through Errors In Apps Script
Brighten Up Your Checklist Automatically
Build a Book Recommender with AI in Google Sheets
Build a Case Converter From Scratch
Build a License Key Generator and API in 20 Minutes
Build a Startup Pitch Generator in 20 minutes
Building an AI Prompts Playground
Build Your Own AI Writer in Google Sheets
Build Your Own Free Domain Availability Checker
Built a Cookie Clicker Clone in Google Sheets
Can I Automatically Rename a Sheet based on a Date?
Capture Emails from Website Form to a Google Sheet (Without Zapier)
ChatGPT Clone in Google Sheets Part 1
ChatGPT Clone in Google Sheets Part 2
Convert Google Sheets into a REST API
Create a ChatGPT Cheat Sheet Spreadsheet
Create an Automated Task List
Create a new Spreadsheet from just a Name in a Sheet.
Create an Internal Google Sheets Add-on
Create a PR Agency From Scratch
Create a Radio Button From Checkboxes Using Google Apps Script
Create a Stop Watch in a Google Sheet
Create a Timer with Apps Script
Create a Tracking Number Fetcher with Google Sheets and Google Sites
Create a Vote Button from Google Sites to Google Sheets
Create a Waterfall of AI Prompts and Responses
Create New Worksheet When Google Form Submitted
Create Your Own NIGHT Mode (like PRIDE)
Create Your Own Pride Flag Easter Egg in Sheets
Creating A Dark Mode Theme | Announcing Dark Habits
Creating a Live Message in Google Sheets
CRM Automations
Curate Google Sheets Easily - Automatic Bookmarklet Maker
Daily Writer's Word Count Tracker
Deep Inside Dark Habits Google Script
Don't Delete My Formulas
Dylan Asks: How to Automatically Delete Rows If Cell Contains Value
Email Certain Department Based on Google Form Entries
Email Myself a Daily Random Motivational Quote
Email Yourself a Cell from a Google Sheet, Every Day
Embed a Headline in a Website from Google Sheets
Embed a Number in a Website from a Google Sheet
Embed Email Form and Name Form into Website to Google Sheets
Embed Quote and Author to Daily Quote Website
Enter Google Drive File Name Get URL
Every Locale Listed in Google Sheets and a Tool to Save Your Sanity
Expense Tracker Template with Data Entry Form Inside Sheets
Extract URLs from Google Sheets
Fast FAQS
FILTER Can Save You From Task Overload
Form Automations: Close Multiple Forms When Over Limit
From Sheet to Script And Back Again - Learn to Code In Google Sheets Part 3
Getting Started Coding in Apps Script
Google Maps Scraper for Outreach
Google Sheets Stories? No! But we'll add timestamped video notes to your google sheets.
Go to Specific Cell When Spreadsheet is Opened
Highlight Row as You Move Your Cell Selection
Hold a Giveaway Raffle in a Google Sheet
How do I reference a different spreadsheet in Apps Script?
How To Change Date Format Automatically
How to Copy To New Tab When Checked
How to Create AI Images From Google Sheets
How To Format Sheets for Notes
How to Format Timestamp to Day and Month
How to Merge Cells in Google Sheets
How To Send Two Emails in Same Trigger
How to Turn Background Color to Text
How to Validate Email Addresses
I Created an Automatic Emailer
Idea Graveyard - Create a Decaying Checklist
Introducing SheetFools
Iterate Numbers with a Simple Apps Script
Laziest Checklist Ever
Learn to Code in Google Sheets, For Programmers
LinkTree in a Google Sheet
Make AI-generated Poems Based on Name
MicroManager: Hourly Email Reminders
Move Blank Rows
Move Entire Row when a Cell is changed to "Yes" - The $75,000 Google Script
Now Do It Every Damn Day - Learn to Code in Google Sheets Part 5
Onboarding Scheduler
One Million Checkboxes
One Weird Google Sheet Formula for Bulk Publishing With AI
OpenAI API Prompt with Array of Cells
Password Protecting Data In a Google Sheet
Password Protecting Data In a Google Sheet Part 2 The Basics
Prompt Parade
Quickly Build a Daily Random Motivational Quote Website
Quickstart Tutorial OpenAI API in Google Sheets
Reformat Pasted Cells Automatically
Run 100 ChatGPTs at One Time
Saving OpenAI API Calls inside of Google Sheets
Scrape Google Maps
Scrape Google Maps Added Phone and Reviews
Send a Button from Google Sheets in an Email
Send a Daily Email with Inspiring Quote - A Little Pick Me Up
Send Daily Email Updates
Shaman: AI Blog Writer
Simple Inventory Management Automations
SOLUTIONS! Solve The Errors, Learn For Loop
Solve The Errors, Learn For Loop
SubSpyHub Subreddit Scanner
Sync Tabs in Different Sections
Sync Two Tabs Without ImportRange()
Tag Emails From A List of Members in Google Sheets
Timestamp When Done (With Code)
Track Every Edit (Almost)
Tweet From a Sheet
Ultimate Prompt Writer and Prompt Rater
Uncheck Every Checkbox in Google Sheets
Visicalc 2023 Design Walkthrough
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 →