Returns the total number of rows the sheet can hold.
class SpreadsheetApp method .getMaxRows()
SpreadsheetApp is the Apps Script service.
.getMaxRows() is the method name you will see after a dot in your code.
What it does
Why it's used
- Check sheet capacity before a huge import.
- Validate that a resize operation will fit.
Common errors
- Forgetting parentheses on getMaxRows. Write SpreadsheetApp.getMaxRows(), not SpreadsheetApp.getMaxRows or getMaxRows by itself.
- Skipping dots between chained calls. Each step needs a dot, like SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Data').getMaxRows().
- Adding spaces where they do not belong. Write SpreadsheetApp.getMaxRows(), not SpreadsheetApp .getMaxRows(), SpreadsheetApp.getMaxRows (), or SpreadsheetApp . getMaxRows().
- Wrong capitalization. Use SpreadsheetApp and getMaxRows, not spreadsheetapp or getmaxrows.
2 Snippets using this methods
Explore
Related methods
-
.getMaxColumns()
Returns the total number of columns the sheet can hold.
-
.getNumRows()
Returns how many rows are in a range.
-
.getLastRow()
Returns the row number of the last row that has content.
-
.getNumColumns()
Returns how many columns are in a range.
-
.getRow()
Returns the starting row index of a range.
More Apps Script
2 Better Sheets tutorials
Automatically Align Top
Automatically Copy Spreadsheet Tab to New File with Values Only, No Formulas
Related blog posts
Written guides about SpreadsheetApp.getMaxRows().
Spreadsheets Explained! 5 Levels of Difficulty: From Basic Text Input to Google Apps Script
Five increasingly difficult ways of explaining spreadsheets in Google Sheets: The basics of Google Sheets text Menu items in Google Sheets Math inside Google Sheets Using Formulas in Google Sheets Apps Script in Google Sheets
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 →Spreadsheets Explained over 5 Levels of Difficulty
Master Google Sheets from simple text input to complex operations with our FREE tutorials, templates, and tools! Unleash the full power of spreadsheets now!
Read post →