apps-script-utils 2.1.1 Help

isGridRangeContainedIn

function isGridRangeContainedIn(gridRange: GridRange, containerGridRange: GridRange): boolean;

Containment is inclusive: a range contains itself. An absent bound on the outer range means it is open in that direction and so contains anything on that axis, which is how a whole column or a whole sheet is expressed.

This is the check to run before writing into a range a user chose, so that a write cannot spill outside the area the script owns.

Parameters

Parameter

Type

Description

gridRange

GridRange

The GridRange object that is potentially a subset (child range).

containerGridRange

GridRange

The GridRange object that is potentially a superset (parent range).

Returns

boolean — true when the first range lies inside the second.

Examples

Checking containment

const inner = { startRowIndex: 1, endRowIndex: 2, startColumnIndex: 1, endColumnIndex: 2 }; const outer = { startRowIndex: 0, endRowIndex: 5, startColumnIndex: 0, endColumnIndex: 5 }; isGridRangeContainedIn(inner, outer); // => true

See also

Source

src/appsscript/sheet/isGridRangeContainedIn.ts

23 September 2026

This documentation was generated with AI (Claude) from the library's source code.