Actions40
- Create Bullets Request Actions
- Create Document Request Actions
- Create Headers & Footers Request Actions
- Create Images Request Actions
- Create Named Ranges Request Actions
- Create Tables Request Actions
- Create Tabs Request Actions
- Create Text Request Actions
- Send Request Actions
Create Named Ranges Request → Create Named Range
AI-generatedSummary
Create a Named Range in a Google Doc.
Inputs
- name — The name of the NamedRange. Names do not need to be unique.
- startIndex (required) — The zero‑based index, in UTF‑16 code units. The index is relative to the beginning of the segment specified by segmentId.
- endIndex (required) — The zero‑based index, in UTF‑16 code units. The index is relative to the beginning of the segment specified by segmentId.
- additionalLocationFields — Additional fields for the end of segment location. Contains options for segmentId and tabId.
Output shape
object representing the created NamedRange, containing its ID and location details
Success returns the created NamedRange; errors are propagated as failures and may include an error object.
Examples
Example 1: Add a named range covering characters 0‑9 in the document body.
Name: myRange; Start Index: 0; End Index: 9; Segment ID: '' (body); Additional Location Fields: {}
Example 2: Define a named range in a header section.
Name: headerRange; Start Index: 5; End Index: 15; Segment ID: 'header'; Additional Location Fields: {segmentId: 'header', tabId: ''}