Reads values from every cell in a range as a 2D array.
class SpreadsheetApp method .getValues()
SpreadsheetApp is the Apps Script service.
.getValues() is the method name you will see after a dot in your code.
What it does
Why it's used
- Load a whole table into memory to filter, sort, or send to an API.
- Much faster than reading cells one at a time in a loop.
Common errors
- Forgetting parentheses on getValues. Write SpreadsheetApp.getValues(), not SpreadsheetApp.getValues or getValues by itself.
- Skipping dots between chained calls. Each step needs a dot, like SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Data').getValues().
- Adding spaces where they do not belong. Write SpreadsheetApp.getValues(), not SpreadsheetApp .getValues(), SpreadsheetApp.getValues (), or SpreadsheetApp . getValues().
- Wrong capitalization. Use SpreadsheetApp and getValues, not spreadsheetapp or getvalues.
Snippets using this method
Explore
Related methods
-
.setValues()
Writes a 2D array of values into a range of cells.
-
.getDisplayValues()
Reads the formatted text shown in every cell in a range.
-
.getValue()
Reads the value stored in a single cell.
-
.getRange()
Returns a range of cells by A1 notation or row and column numbers.
-
.getDisplayValue()
Reads the formatted text shown in a cell, not the raw value.
More Apps Script
Better Sheets tutorials
2 New Ways To Add Emoji Reactions
Add Click Tracking To Your Google Sheets | Bitly in a Google Sheet
Automate Form Response to Confirmation Email
Automate Move Blank Rows
Related blog posts
Written guides about SpreadsheetApp.getValues().
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 →