Returns the size of the range this is the width * height.
Returns an iterator that allows you to iterate over the individual values within the range.
For more advanced iteration, use ICellRange.entries or ICellRange.forEach.
Add a listener to the range.
Optional
options: ListenerOptionsA callback to remove. IListener.Remove
Fill the range to a destination using an array of IAutoFill.Filler.
The range to autoFill including the current range.
Optional
options: AutoFillOptionsICellRange
at the destination.
Adjusts the column widths and rows heights to fit the content.
Optional
options: AutoFitOptionsCurrent ICellRange
.
Re-evaluates and formulas within the range.
Optional
full: booleanIf true
then all formulas will be recalculated.
Clear the range.
Optional
applyTo: ContentOptional
options: OperationOptionsCurrent ICellRange
.
Copies (or cuts) data and formatting from a specified source to the current range.
The source of the data and formatting to be copied or cut.
This can be either a range address, another range object, or an ISnapshot
created using the getSnapshot
method.
Optional
options: ICellRange.CopyOptionsAdditional options for customizing the paste operation (e.g., transpose
, skipBlanks
).
A promise that resolve to an ICellRange
or 'null' when the copy has completed.
Delete the cells within the range and shifts the remaining cells to fill the gap.
Optional
orientation: IRange.OrientationThe direction in which to shift the remaining cells. Defaults to the orientation where the range's dimension is smaller (e.g., shifts left if the range is taller than it is wide). See ICellRange.getDefaultShiftOrientation for details on the default behavior.
Optional
options: OperationOptionsCurrent ICellRange
.
Perform a set of operations as a batch.
The callback return type.
Function to perform the operations.
Optional
options: string | OperationOptionsDescription of the operation or additional options. This will be used for tracking undo/redo and history.
The result of the callback.
Returns an iterator that allows you to iterate over the individual entries within the range,
yielding pairs of IteratorContext
and a Value
.
Optional
options: ICellRange.IteratorOptionsConfiguration options for the iterator, such as filtering or sorting.
An iterator that yields [ICell.IteratorContext, Value]
tuples for each value within the range.
Returns an iterator of ICells that match the results.
The text to search for.
Optional
options: FindOptionsIterates over the cells within the range, applying the provided callback function to each cell.
This method is a more scalable alternative to getValues
or getCells
for large or sparse ranges,
as it:
A function that will be called for each non-empty cell in the range. The callback receives:
value
: The Scalar
at the current cell.context
: A IteratorContext
object providing additional information and utilities for the cell.{ break: T }
to stop the iteration early.Optional
options: ICellRange.IteratorOptionsICellRange.IteratorOptions for configuring which cells to visit.
The value returned by the callback function if it explicitly returned to stop the iteration early; otherwise, void
.
Returns the Coords
an A1-style address string (e.g., 'A1' or 'A1:E5').
Returns the absolute bounds for the range.
Return a 2D array of cells in the shape of the range.
Optional
options: GetValuesOptionsA 2D array of ICells.
null
.Returns the number of columns of the range.
Returns the right of the range.
Returns the header range for the columns.
Optional
options: GetRangeOptionsICellHeaderRange
for the columns.
Returns the column start.
The IRange.Coords.
Returns a count for of values.
Returns the default shift IRange.Orientation for insert and delete if no orientation is provided.
Default IRange.Orientation
that will be used to shift the range.
Returns a default sort that would be used if no overrides where provided.
Optional
orientation: IRange.OrientationThe orientation to sort. Default Value IRange.Orientation.Row
.
Optional
cell: ICell.AddressA cell location that can be used to determine the sort column.
Default ISort.DefaultSortCriteria
or null
if there is not valid sort criteria.
Returns a set of non-overlapping ranges the represents the difference between the current range and the specified range.
The address of the range to subtract from the current range.
Optional
options: GetRangeOptionsICellRanges
containing the resulting non-overlapping ranges,
or null
if:
Returns a range that includes the columns for the entire sheet.
For example, if the range is A1:B2
, this method will return A:B
.
Optional
shift: booleanIf true
this will also shift the columns by the width of the range. default false
.
Optional
options: GetRangeOptionsAdditional options for getting the range.
ICellRange
at the repositioned range.
Returns a range that includes the rows for the entire sheet.
For example, if the range is A1:B2
, this method will return 1:2
.
Optional
shift: booleanIf true
this will also shift the rows by the height of the range. default false
.
Optional
options: GetRangeOptionsAdditional options for getting the range.
ICellRange
at the repositioned range.
Returns a range that includes the current range up to a content edge boundary.
ICellRange
extended in the given direction.
Returns a range with coordinates adjusted to be fixed (absolute) or flexible (relative).
Optional
options: boolean | GetFixedOptionsEither a ICellRange.GetFixedOptions object to
specify individual coordinate settings, or a boolean
to adjust all coordinates at once. If a boolean
is provided:
- true
sets all coordinates to absolute.
- false
sets all coordinates to relative.
ICellRange
with updated coordinate references types.
Returns the height of the range.
Returns the intersection of the current range and the specified range.
Optional
address: ICellRange.AddressThe address of the other range to intersect with..
Optional
options: GetRangeOptionsICellRange
at the intersection of the two ranges, or null
if there's no overlap.
Returns a range with the top-left corner moved by the specified row and column offsets.
The number of rows to move the top-left corner up (negative) or down (positive).
The number of columns to move the top-left corner left (negative) or right (positive).
Optional
options: GetRangeOptionsICellRange
at the repositioned range.
Returns a range repositioned to the specified starting row and column indices.
The new starting row index (inclusive).
The new starting column index (inclusive).
Optional
options: GetRangeOptionsICellRange
at the repositioned range.
Returns a range with the bottom-right corner moved by the specified row and column offsets.
The number of rows to move the bottom-right corner up (negative) or down (positive).
The number of columns to move the bottom-right corner left (negative) or right (positive).
Optional
options: GetRangeOptionsICellRange
with the resized range.
Resizes the current range to the specified ending row and column indices.
The new ending row index (inclusive).
The new ending column index (inclusive).
Optional
options: GetRangeOptionsICellRange
with the resized range.
Returns the number of rows of the range.
Returns the bottom of the range.
Returns the header range for the rows.
Optional
options: GetRangeOptionsICellHeaderRange
for the rows.
Returns the top of the range.
Returns a snapshot of the current range's data and formatting suitable for copying or archiving.
Optional
options: ICellRange.CopyOptionsDefault options to apply during the copy operation.
A ISnapshot
object representing the range.
Retrieves an IStyle.Updater object for updating the styles of the range.
Unlike ICell.getStyle, which provides a read-only view of a cell's style, this method returns an updater object that allows modifications to the styles of all cells in the range.
A style updater for the range.
IStyle.Updater
are applied
to the entire range, overriding any mixed styles with the specified values.ICell
objects are immutable, while ICellRange
is the interface for mutable operations.Returns a range with surrounding data or the entire range if there is no data nearby.
Optional
options: GetSurroundingOptionsICellRange
containing either nearby content or the entire range.
Returns the union of the current range with the specified range.
Optional
address: ICellRange.AddressThe address of the other range to intersect with.
Optional
options: GetRangeOptionsICellRange
at the union of the two ranges.
Returns the smallest range within the range that contains any used cells.
This method returns the range of cells that have been "used," which includes cells with data, as well as certain types of formatting or styling. It focuses on cells that have been interacted with in some form, whether through data entry or other modifications. Merged cells and overflow values may not always be included in this range.
Optional
options: GetRangeOptionsICellRange
that contains the smallest range with used cells, or null
if the range is empty.
Returns the value for the top left Scalar
.
Optional
options: GetValuesOptionsReturns a 2D array of values in the shape of the range.
Optional
options: GetValuesOptionsasJSDate
Return dates as Javascript dates instead of OADates but is slower due to need
to determine if the Cell is a date or a number. See ICell.IteratorContext.toJSDate.
defaultValue false
.
maxSize
Limit the size of the results. defaultValue 10000
.A 2D array of values.
null
.true
will add make slower.Returns a range that excludes any hidden rows or columns.
Optional
options: GetVisibleOptionsOptional parameters that can adjust how visibility is determined (e.g., by ignoring specific visibility rules).
An ICellRanges
object that contains the visible portions of the range, excluding any hidden rows or columns.
ICellRanges
object with a single range and a length of 1
.null
.Returns the width of the range.
Insert a new, empty range within the sheet and shifts existing cells to accommodate it.
By default the values will direction in whichever direction the selection shape is smaller. For example a selection with a 5 column by 1 row will direction Down (rows). Note - This will error if direction data will fall outsize of the max sheet size.
Optional
orientation: IRange.OrientationThe direction in which to shift existing cells. Defaults to the orientation where the range's dimension is smaller (e.g., shifts down if the range is wider than it is tall). See ICellRange.getDefaultShiftOrientation for details on the default behavior.
Optional
options: OperationOptionsCurrent ICellRange
.
Inserts the contents of the source
into the sheet, shifting existing cells to make space.
The source of the data and formatting to insert.
This can be either a range address, another range object, or an ISnapshot
created using the getSnapshot
method.
Optional
options: InsertFromOptionsA promise that resolve to an ICellRange
or 'null' when the copy has completed.
Checks if the ranges is empty, meaning it has no values or formatting.
Returns true
if the range represents the entire columns.
Returns true
if the range represents both entire rows and entire columns.
Returns true
if the range represents the entire rows.
Returns true if the range is invalid. This can occur if a range is removed or created with invalid coordinates.
Indicates if the range is readonly only.
Merges all cells within the selection ranges.
Optional
options: IRange.Orientations | MergeOptionsCurrent ICellRange
.
Selects the current range.
Optional
options: ICellRange.SelectOptionsAn async ICellRange
.
Update the comments for the range.
Comment properties
Optional
options: OperationOptionsCurrent ICellRange
.
Set the hyperlink for a range of values.
Optional
options: OperationOptionsCurrent ICellRange
.
Set a single value to the entire range.
Optional
options: SetValuesOptionsSet the value(s) of one or more cells within a range.
The value to be set or a callback that will generate a value.
Optional
options: SetValuesOptionsThe current ICellRange
.
null
values will clear the corresponding cells.undefined
values will be ignored, leaving the existing cell values unchanged.Sort the given range.
Optional
options: boolean | RangeOptions & OperationOptionsboolean
| ISort.RangeOptions
Current ICellRange
.
Creates a IncrementalUpdater
for efficiently updating sparsely populated cells in a streaming low memory way.
For contiguous or mostly contiguous updates, the ICellRange.updateCells method is simpler and will use ICellRange.IncrementalUpdater internally.
Optional
options: StartUpdateOptionsICellRange.StartUpdateOptions
Ordering: By default updates must be added in either row-major or column-major order, as specified
by the orientation
parameter, with major/minor coordinates increasing monotonically. Unless
allowUnorderedWrites
is set to `true out of order updates will result in an error.
Performance: Setting orientation
to IRange.Orientation.Column
is generally faster as it aligns with the internal data representation.
Performance: Setting allowUnorderedWrites
adds a nominal performance overhead for all updates and will do a full apply when an
out of order update is detected.
The default IRange.Orientation.Row
is provided for compatibility with common spreadsheet APIs.
Validation: Data validation (e.g., for protected cells or boundaries) is performed when the apply
method is called.
Transactions:
IncrementalUpdater
only builds a temporary representation of the updates.
No actual changes are made to the sheet until apply
is called.doBatch
.Returns the address as a string.
Unmerge all cells within the selection ranges.
Optional
options: OperationOptionsCurrent ICellRange
.
Provides a convenient method for setting values with a range of calls.
Optional
options: UpdateCellsOptionsThe current ICellRange
.
Update the style for the range(s).
Optional
options: UpdateOptionsCurrent ICellRange
.
A ICellRange represents a rectangular collection of ICell within an ISheet.
Naming Conventions: Methods usually adhere to the following conventions except when adhering to a idiomatic existing conventions of Typescript (for example
size
or 'length'):get
prefix.to
prefix (e.g.,toArray()
).