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

Returns the total number of rows the sheet can hold.

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.

Explore

Related methods

2 Better Sheets tutorials

Automatically Align Top

Automatically Align Top

Automate formatting cells to align top. Either by a time-based trigger o...
Automatically Copy Spreadsheet Tab to New File with Values Only, No Formulas

Automatically Copy Spreadsheet Tab to New File with Values Only, No Formulas

Automatically copy a spreadsheet tab to a whole new spreadsheet file, ge...

Related blog posts

Written guides about SpreadsheetApp.getMaxRows().

Browse the blog