getNamedRangeByName
function getNamedRangeByName(
spreadsheet: GoogleAppsScript.Spreadsheet.Spreadsheet,
name: string
): GoogleAppsScript.Spreadsheet.NamedRange | null;
A named range is the stable way to point at a block of cells that a person may move around the sheet. Apps Script only offers the whole list, so the names are walked and compared.
A name that is not defined gives null, which is the case to handle when a template has been edited by hand.
Parameters
Parameter | Type | Description |
|---|---|---|
|
| The spreadsheet to look in. |
|
| The name of the range. |
Returns
GoogleAppsScript.Spreadsheet.NamedRange | null — the named range, or null when no such name is defined.
Examples
Looking up
const spreadsheet = SpreadsheetApp.getActive();
const range = getNamedRangeByName(spreadsheet, "Settings");
range?.getRange().getValues();
See also
Source
23 September 2026
This documentation was generated with AI (Claude) from the library's source code.