apps-script-utils 2.1.1 Help

requireGridRangeSameDimensions

function requireGridRangeSameDimensions( range1: GridRange, range2: GridRange, message?: string ): void;

The assertion form of isGridRangeSameDimensions. The default message states both sizes, so a mismatched copy says how far off it was.

Parameters

Parameter

Type

Description

range1

GridRange

The first range.

range2

GridRange

The second range.

message (optional)

string

The message of the exception. A default stating both sizes is used when omitted.

Returns

void — the first range, unchanged.

Throws

Exception

Condition

InvalidGridRangeException

the two ranges are not the same size.

Examples

Guarding a copy

const source = { startRowIndex: 0, endRowIndex: 2, startColumnIndex: 0, endColumnIndex: 2 }; const target = { startRowIndex: 5, endRowIndex: 7, startColumnIndex: 5, endColumnIndex: 7 }; requireGridRangeSameDimensions(source, target); // => the source range

See also

Source

src/appsscript/sheet/requireGridRangeSameDimensions.ts

23 September 2026

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