Skip to main content

Cell.Range

Cell.Range is an object type of the Spreadsheet module (Office.cell(iframe)). 76 methods.

Generated from the SDK type definitions

Spreadsheet · 6 object types · 156 methods · namespace Cell. This reference is generated from the API document artifact (sdk-api-doc.html) produced with the SDK build. Descriptions are the editor's API comments as published. Pin the SDK and Office versions together and regenerate when either changes.

Remarks

Methods

MethodDescription
addConditionalFormat(rule)Adds a conditional formatting rule to the range.
autofitColumns()Fits the width of the columns the range spans to each column's content.
autofitRows()Fits the height of the rows the range spans to each row's content.
clearAll()Clears everything in the range: values, formulas, formatting, merges, hyperlinks, comments, data validation, sparklines, filters, and tables.
clearConditionalFormats()Deletes the conditional formatting rules that overlap the range.
clearDataValidation()Deletes the data validation rules that overlap the range.
clearFormat()Clears the cell formatting (font, fill, alignment, borders, number format) of the range and releases the merges inside it.
decreaseIndent()Decreases the indent level of the range by one.
deleteColumn()Deletes the columns the range spans.
deleteComment()Deletes every comment in the range.
deleteRow()Deletes the rows the range spans.
deleteValue()Clears the values and formulas of every cell in the range.
getAddress(includeSheetName)Returns the A1 address of this range ("B2:C5", or "E10" for a single cell).
getAlignment()Returns the alignment formatting of the top-left cell of the range at once.
getBackgroundColor()Returns the background color of the top-left cell of the range.
getBorder()Returns the borders of the top-left cell of the range, split into the four edges and the diagonals.
getCellContent()Returns the value, display string, and formula of the top-left cell of the range at once.
getCellContents()Returns the values, display strings, and formulas of the whole range as row-major two-dimensional arrays.
getColumnWidth()Returns the width (px) of the first column of the range.
getCoordinates()Returns the 0-based coordinates of this range.
getDisplayValue()Returns the on-screen display string of the top-left cell of the range.
getDisplayValues()Returns the on-screen display strings of the whole range as a row-major two-dimensional array.
getFill()Returns the fill of the top-left cell of the range.
getFont()Returns the font formatting of the top-left cell of the range at once.
getFontColor()Returns the font color of the top-left cell of the range.
getFontName()Returns the font name of the top-left cell of the range.
getFontSize()Returns the font size (pt) of the top-left cell of the range.
getFontUnderline()Returns the underline type of the top-left cell of the range.
getFormula()Returns the top-left cell's formula string; undefined for non-formula cells (constants, empty cells).
getFormulas()Returns the formulas of the whole range as a row-major two-dimensional array.
getHorizontalAlign()Returns the horizontal alignment of the top-left cell of the range.
getHyperlinkList()Returns the hyperlinks that overlap the range, including links that overlap only partly.
getIndent()Returns the indent level of the top-left cell of the range.
getMergeCellList()Returns the addresses of the merged areas that overlap the range as an array of A1 strings.
getNumberFormat()Returns the number format of the top-left cell of the range.
getRowHeight()Returns the height (px) of the first row of the range.
getValue()Returns the raw value of the top-left cell of the range as a string, number, or boolean; a formula cell returns its calculated result.
getValues()Returns the values of the whole range as a row-major two-dimensional array.
getVerticalAlign()Returns the vertical alignment of the top-left cell of the range.
increaseIndent()Increases the indent level of the range by one.
insertColumn(count)Inserts columns at the position of the first column of the range.
insertRow(count)Inserts rows at the position of the first row of the range.
isColumnVisible()Returns whether the first column of the range is visible.
isFontBold()Returns whether the top-left cell of the range is bold.
isFontItalic()Returns whether the top-left cell of the range is italic.
isFontStrikethrough()Returns whether the top-left cell of the range has a strikethrough.
isRowVisible()Returns whether the first row of the range is visible.
isSingleCell()Returns whether the range is a single cell.
isWrapText()Returns whether text wrapping is applied to the top-left cell of the range.
merge()Merges the cells of the range into one.
removeHyperlink()Deletes the hyperlinks that contain the range or are contained by it; a link that overlaps only partly remains.
setBackgroundColor(color)Fills the range with a solid background color.
setBorder(type, lineStyle, color)Applies or clears borders on the range.
setColumnVisible(visible)Shows or hides the columns the range spans.
setColumnWidth(width)Sets the width of the columns the range spans.
setComment(text)Puts a comment on the top-left cell of the range.
setCommentVisible(visible)Changes the display state of the comment on the top-left cell of the range.
setDataValidation(rule)Applies a data validation rule to the range.
setFontBold(isOn)Applies or removes bold on the range.
setFontColor(color)Changes the font color of the range.
setFontItalic(isOn)Applies or removes italic on the range.
setFontName(name)Changes the font of the range.
setFontSize(size)Changes the font size of the range.
setFontStrikethrough(isOn)Applies or removes a strikethrough on the range.
setFontUnderline(isOn, isDouble)Applies or removes an underline on the range.
setHorizontalAlign(value)Sets the horizontal alignment of the range.
setHyperlink(options)Puts a hyperlink on the range.
setNumberFormat(formatCode)Sets the number format of the range with a format code.
setRowHeight(height)Sets the height of the rows the range spans.
setRowVisible(visible)Shows or hides the rows the range spans.
setValue(value)Puts the same value into every cell of the range.
setValues(values)Puts a different value into each cell of the range.
setVerticalAlign(value)Sets the vertical alignment of the range.
setWrapText(isOn)Applies or removes text wrapping on the range.
sort(key, order, options)Sorts the range by the values of the given column.
unmerge()Releases every merge that overlaps the range.

Method details

addConditionalFormat(rule)

Adds a conditional formatting rule to the range. The added rule is applied before existing rules. It does nothing when the rule is invalid.

addConditionalFormat(rule: Record<string, unknown>): Promise<void>;

Parameters

NameTypeDescription
ruleRecord<string, unknown>rule object; rule_type uses the ConditionalFormatRuleType vocabulary, the operator of cellIs uses ConditionalFormatOperator, the time_period of timePeriod uses ConditionalFormatTimePeriod, and cfvo[].type of a visual rule uses ConditionalFormatValueType. The highlight formatting of formula-style rules is given with style; omitting it uses the default highlight. colorScale is given with colors (2-3 ARGB values), and dataBar and iconSet with presets (data_bar, icon_set)

Returns

Promise<void>

autofitColumns()

Fits the width of the columns the range spans to each column's content. A column adjusted this way can widen again to fit numeric cell content when values are entered or the font size or indent changes later.

autofitColumns(): Promise<void>;

Returns

Promise<void>

autofitRows()

Fits the height of the rows the range spans to each row's content. A row adjusted this way keeps fitting its height automatically when the content changes later.

autofitRows(): Promise<void>;

Returns

Promise<void>

clearAll()

Clears everything in the range: values, formulas, formatting, merges, hyperlinks, comments, data validation, sparklines, filters, and tables. A whole-row or whole-column range that overlaps a merge raises an error.

clearAll(): Promise<void>;

Returns

Promise<void>

clearConditionalFormats()

Deletes the conditional formatting rules that overlap the range. When a rule extends beyond the range, only the overlapping part is removed from the rule's applied range; when the whole rule falls inside the range, the rule itself is deleted.

clearConditionalFormats(): Promise<void>;

Returns

Promise<void>

clearDataValidation()

Deletes the data validation rules that overlap the range. When a rule extends beyond the range, only the overlapping part is removed from its applied range.

clearDataValidation(): Promise<void>;

Returns

Promise<void>

clearFormat()

Clears the cell formatting (font, fill, alignment, borders, number format) of the range and releases the merges inside it. Values and formulas remain. A whole-row or whole-column range that overlaps a merge raises an error.

clearFormat(): Promise<void>;

Returns

Promise<void>

decreaseIndent()

Decreases the indent level of the range by one. It does not go below 0.

decreaseIndent(): Promise<void>;

Returns

Promise<void>

deleteColumn()

Deletes the columns the range spans. They cannot be deleted when every column of the sheet, or the last visible column, would be removed, or when the whole area to the right of the freeze pane would be removed.

deleteColumn(): Promise<void>;

Returns

Promise<void>

deleteComment()

Deletes every comment in the range.

deleteComment(): Promise<void>;

Returns

Promise<void>

deleteRow()

Deletes the rows the range spans. When the range covers a table's whole data area, one data row is kept so that the table does not disappear.

deleteRow(): Promise<void>;

Returns

Promise<void>

deleteValue()

Clears the values and formulas of every cell in the range. Formatting remains.

deleteValue(): Promise<void>;

Returns

Promise<void>

getAddress(includeSheetName)

Returns the A1 address of this range ("B2:C5", or "E10" for a single cell). With the sheet name included, a name containing spaces or special characters is quoted. getRange() does not accept that form.

getAddress(includeSheetName?: boolean): Promise<string>;

Parameters

NameTypeDescription
includeSheetName (optional)booleantrue prefixes the sheet name, false returns the address only (default: false)

Returns

Promise<string>

getAlignment()

Returns the alignment formatting of the top-left cell of the range at once. Each item is the same as the individual getter of the same name.

getAlignment(): Promise<AlignmentInfo | undefined>;

Returns

Promise<AlignmentInfo | undefined> - undefined when the cell carries no formatting

getBackgroundColor()

Returns the background color of the top-left cell of the range. It is undefined when there is no fill, and also for a gradient fill, which cannot be expressed as a single color. Use getFill when the fill type matters.

getBackgroundColor(): Promise<string | undefined>;

Returns

Promise<string | undefined> - color in "#RRGGBB" form

getBorder()

Returns the borders of the top-left cell of the range, split into the four edges and the diagonals. Only lines that are actually drawn are included.

getBorder(): Promise<BorderInfo | undefined>;

Returns

Promise<BorderInfo | undefined> - undefined when the cell carries no formatting

getCellContent()

Returns the value, display string, and formula of the top-left cell of the range at once. Each item is the same as getValue, getDisplayValue, and getFormula.

getCellContent(): Promise<CellContent>;

Returns

Promise<CellContent>

getCellContents()

Returns the values, display strings, and formulas of the whole range as row-major two-dimensional arrays. The array size matches the range size.

getCellContents(): Promise<CellContent[][]>;

Returns

Promise<CellContent[][]>

getColumnWidth()

Returns the width (px) of the first column of the range.

getColumnWidth(): Promise<number>;

Returns

Promise<number>

getCoordinates()

Returns the 0-based coordinates of this range. Use getAddress() when an A1 address is needed. It throws SHEET_NOT_FOUND when the sheet has been deleted.

getCoordinates(): Promise<SheetRangeCoords>;

Returns

Promise<SheetRangeCoords>

getDisplayValue()

Returns the on-screen display string of the top-left cell of the range. It is the result of the number format, so it can differ from the stored value.

getDisplayValue(): Promise<string>;

Returns

Promise<string> - Empty string if the cell is empty

getDisplayValues()

Returns the on-screen display strings of the whole range as a row-major two-dimensional array. The array size matches the range size.

getDisplayValues(): Promise<string[][]>;

Returns

Promise<string[][]> - an empty cell is an empty string

getFill()

Returns the fill of the top-left cell of the range. For a gradient fill only the type is included; the colors, direction, and the rest are not.

getFill(): Promise<FillInfo | undefined>;

Returns

Promise<FillInfo | undefined> - undefined when there is no fill

getFont()

Returns the font formatting of the top-left cell of the range at once. Each item is the same as the individual getter of the same name, except underline, which is "none" rather than undefined when there is no underline.

getFont(): Promise<FontInfo | undefined>;

Returns

Promise<FontInfo | undefined> - undefined when the cell carries no formatting

getFontColor()

Returns the font color of the top-left cell of the range. A cell with no explicit color carries the document default color.

getFontColor(): Promise<string | undefined>;

Returns

Promise<string | undefined> - color in "#RRGGBB" form

getFontName()

Returns the font name of the top-left cell of the range. A cell with no explicit font carries the document default font name.

getFontName(): Promise<string | undefined>;

Returns

Promise<string | undefined>

getFontSize()

Returns the font size (pt) of the top-left cell of the range. A cell with no explicit size carries the document default size.

getFontSize(): Promise<number | undefined>;

Returns

Promise<number | undefined>

getFontUnderline()

Returns the underline type of the top-left cell of the range.

getFontUnderline(): Promise<"single" | "double" | undefined>;

Returns

Promise<"single" | "double" | undefined> - undefined when there is no underline

getFormula()

Returns the top-left cell's formula string; undefined for non-formula cells (constants, empty cells).

getFormula(): Promise<string | undefined>;

Returns

Promise<string | undefined>

getFormulas()

Returns the formulas of the whole range as a row-major two-dimensional array. The array size matches the range size.

getFormulas(): Promise<(string | null)[][]>;

Returns

Promise<(string | null)[][]> - a cell that is not a formula is null

getHorizontalAlign()

Returns the horizontal alignment of the top-left cell of the range. Only an explicitly set value is returned, and a value outside HorizontalAlign can come back.

getHorizontalAlign(): Promise<string | undefined>;

Returns

Promise<string | undefined> - undefined when nothing is set

Returns the hyperlinks that overlap the range, including links that overlap only partly.

getHyperlinkList(): Promise<HyperlinkInfo[]>;

Returns

Promise<HyperlinkInfo[]>

getIndent()

Returns the indent level of the top-left cell of the range.

getIndent(): Promise<number>;

Returns

Promise<number> - 0 when no indent is set

getMergeCellList()

Returns the addresses of the merged areas that overlap the range as an array of A1 strings. A merge that overlaps only partly is not clipped to the range; the whole merged area's address is given. Use Worksheet.getMergeCellList for the merges of the whole sheet.

getMergeCellList(): Promise<string[]>;

Returns

Promise<string[]>

getNumberFormat()

Returns the number format of the top-left cell of the range. Even a cell with no explicit format carries the code of the document default format.

getNumberFormat(): Promise<{ formatCode: string }>;

Returns

Promise<{ formatCode: string }> - formatCode is a format code that can be passed straight to setNumberFormat

getRowHeight()

Returns the height (px) of the first row of the range.

getRowHeight(): Promise<number>;

Returns

Promise<number>

getValue()

Returns the raw value of the top-left cell of the range as a string, number, or boolean; a formula cell returns its calculated result.

getValue(): Promise<string | number | boolean | undefined>;

Returns

Promise<string | number | boolean | undefined> - an empty cell is undefined

getValues()

Returns the values of the whole range as a row-major two-dimensional array. The outer array is rows and the inner array is columns, and the array size matches the range size. Each value has the same shape as getValue.

getValues(): Promise<(string | number | boolean | undefined)[][]>;

Returns

Promise<(string | number | boolean | undefined)[][]> - empty cells are filled with undefined

getVerticalAlign()

Returns the vertical alignment of the top-left cell of the range. Only an explicitly set value is returned, and a value outside VerticalAlign can come back. A cell with nothing set is drawn at the bottom.

getVerticalAlign(): Promise<string | undefined>;

Returns

Promise<string | undefined> - undefined when nothing is set

increaseIndent()

Increases the indent level of the range by one. When the horizontal alignment of the range is not uniformly left or right, the whole range is set to left alignment first and then increased.

increaseIndent(): Promise<void>;

Returns

Promise<void>

insertColumn(count)

Inserts columns at the position of the first column of the range. They follow the formatting of the preceding column. Inserting at the first column of the sheet inserts columns without formatting.

insertColumn(count?: number | null): Promise<void>;

Parameters

NameTypeDescription
count (optional)number | nullnumber of columns to insert; when it is not 1 or greater, as many columns as the range spans are inserted

Returns

Promise<void>

insertRow(count)

Inserts rows at the position of the first row of the range. They follow the formatting of the preceding row. Inserting at the first row of the sheet inserts rows without formatting.

insertRow(count?: number | null): Promise<void>;

Parameters

NameTypeDescription
count (optional)number | nullnumber of rows to insert; when it is not 1 or greater, as many rows as the range spans are inserted

Returns

Promise<void>

isColumnVisible()

Returns whether the first column of the range is visible.

isColumnVisible(): Promise<boolean | undefined>;

Returns

Promise<boolean | undefined>

isFontBold()

Returns whether the top-left cell of the range is bold.

isFontBold(): Promise<boolean | undefined>;

Returns

Promise<boolean | undefined> - undefined when it is not bold

isFontItalic()

Returns whether the top-left cell of the range is italic.

isFontItalic(): Promise<boolean | undefined>;

Returns

Promise<boolean | undefined> - undefined when it is not italic

isFontStrikethrough()

Returns whether the top-left cell of the range has a strikethrough.

isFontStrikethrough(): Promise<boolean | undefined>;

Returns

Promise<boolean | undefined> - undefined when there is no strikethrough

isRowVisible()

Returns whether the first row of the range is visible.

isRowVisible(): Promise<boolean | undefined>;

Returns

Promise<boolean | undefined>

isSingleCell()

Returns whether the range is a single cell. A range that spans several rows or columns is false.

isSingleCell(): Promise<boolean>;

Returns

Promise<boolean>

isWrapText()

Returns whether text wrapping is applied to the top-left cell of the range.

isWrapText(): Promise<boolean | undefined>;

Returns

Promise<boolean | undefined> - undefined when wrapping is not applied

merge()

Merges the cells of the range into one. Only the value of the top-left cell remains; the other values are lost. It does nothing when the range is a single cell or overlaps a table. It raises an error when a merge extends beyond the range.

merge(): Promise<void>;

Returns

Promise<void>

Deletes the hyperlinks that contain the range or are contained by it; a link that overlaps only partly remains. The cell value is left as it is and only the link formatting (blue underline) is removed with the link, and the formatting of another link that overlapped the deleted one is restored.

removeHyperlink(): Promise<void>;

Returns

Promise<void>

setBackgroundColor(color)

Fills the range with a solid background color. Without a color, the fill is cleared.

setBackgroundColor(color?: string | null): Promise<void>;

Parameters

NameTypeDescription
color (optional)string | nullcolor in "#RRGGBB" form; null, undefined, or an empty string clears the fill

Returns

Promise<void>

setBorder(type, lineStyle, color)

Applies or clears borders on the range. With type "none" every border of the range is cleared; any other type merges the borders it names into the existing ones. With lineStyle "none" only the lines at the position type names are cleared and color is ignored. When there is no inner line to draw, "center", "middle", and "cross" do nothing.

setBorder(
type: BorderType,
lineStyle?: BorderLineStyle | null,
color?: string | null
): Promise<void>;

Parameters

NameTypeDescription
typeBorderTypewhere to draw the border
lineStyle (optional)BorderLineStyle | nullLine style (default: "thin")
color (optional)string | nullline color in "#RRGGBB" form (default: "#000000")

Returns

Promise<void>

setColumnVisible(visible)

Shows or hides the columns the range spans. It does nothing when visible is null or undefined.

setColumnVisible(visible: boolean): Promise<void>;

Parameters

NameTypeDescription
visiblebooleantrue shows, false hides

Returns

Promise<void>

setColumnWidth(width)

Sets the width of the columns the range spans. Setting a width on a hidden column also unhides it. A value of 0 or less hides the column without changing its width. A column set this way keeps a fixed width and does not widen automatically when the content changes.

setColumnWidth(width: number): Promise<void>;

Parameters

NameTypeDescription
widthnumbercolumn width (px)

Returns

Promise<void>

setComment(text)

Puts a comment on the top-left cell of the range. When a comment already exists, only its body changes and its display state and position stay.

setComment(text: string): Promise<void>;

Parameters

NameTypeDescription
textstringcomment body; unformatted text where a line break is "\n"

Returns

Promise<void>

setCommentVisible(visible)

Changes the display state of the comment on the top-left cell of the range. It does nothing when there is no comment.

setCommentVisible(visible: boolean): Promise<void>;

Parameters

NameTypeDescription
visiblebooleantrue always shows it, false shows it only on hover

Returns

Promise<void>

setDataValidation(rule)

Applies a data validation rule to the range. A cell carries only one rule, so an existing overlapping rule gives up the overlapping part of its applied range and is replaced by this rule. It does nothing when the rule is invalid.

setDataValidation(rule: Record<string, unknown>): Promise<void>;

Parameters

NameTypeDescription
ruleRecord<string, unknown>rule object; type uses the DataValidationType vocabulary, operator uses DataValidationOperator, and errorStyle uses DataValidationErrorStyle, and it carries formula and the prompt and error messages according to the type

Returns

Promise<void>

setFontBold(isOn)

Applies or removes bold on the range.

setFontBold(isOn: boolean): Promise<void>;

Parameters

NameTypeDescription
isOnbooleantrue applies it, false removes it

Returns

Promise<void>

setFontColor(color)

Changes the font color of the range.

setFontColor(color: string): Promise<void>;

Parameters

NameTypeDescription
colorstringcolor in "#RRGGBB" form

Returns

Promise<void>

setFontItalic(isOn)

Applies or removes italic on the range.

setFontItalic(isOn: boolean): Promise<void>;

Parameters

NameTypeDescription
isOnbooleantrue applies it, false removes it

Returns

Promise<void>

setFontName(name)

Changes the font of the range.

setFontName(name: string): Promise<void>;

Parameters

NameTypeDescription
namestringFont name

Returns

Promise<void>

setFontSize(size)

Changes the font size of the range.

setFontSize(size: number | string): Promise<void>;

Parameters

NameTypeDescription
sizenumber | stringFont size (pt)

Returns

Promise<void>

setFontStrikethrough(isOn)

Applies or removes a strikethrough on the range.

setFontStrikethrough(isOn: boolean): Promise<void>;

Parameters

NameTypeDescription
isOnbooleantrue applies it, false removes it

Returns

Promise<void>

setFontUnderline(isOn, isDouble)

Applies or removes an underline on the range.

setFontUnderline(isOn: boolean, isDouble?: boolean): Promise<void>;

Parameters

NameTypeDescription
isOnbooleantrue applies it, false removes it; with false, isDouble is ignored
isDouble (optional)booleantrue for a double underline, false for a single underline (default: false)

Returns

Promise<void>

setHorizontalAlign(value)

Sets the horizontal alignment of the range. Setting it also resets the indent of the range to 0. A value outside HorizontalAlign is stored without validation; "centerContinuous" and "center-across" are drawn centered and any other value is drawn left.

setHorizontalAlign(value: HorizontalAlign): Promise<void>;

Parameters

NameTypeDescription
valueHorizontalAlignHorizontal alignment

Returns

Promise<void>

Puts a hyperlink on the range. The link and its formatting (blue underline) go on the whole range, but the display text goes only on the top-left cell.

setHyperlink(options: HyperlinkOptions): Promise<void>;

Parameters

NameTypeDescription
optionsHyperlinkOptions-

Returns

Promise<void>

setNumberFormat(formatCode)

Sets the number format of the range with a format code. The code you pass is stored as a custom format.

setNumberFormat(formatCode: string): Promise<void>;

Parameters

NameTypeDescription
formatCodestringExcel-compatible format code ("#,##0.00", "yyyy-mm-dd", "0.00%", and so on)

Returns

Promise<void>

setRowHeight(height)

Sets the height of the rows the range spans. Setting a height on a hidden row also unhides it. A value of 0 or less hides the row without changing its height. A row set this way keeps a fixed height and does not adjust automatically when the content changes.

setRowHeight(height: number): Promise<void>;

Parameters

NameTypeDescription
heightnumberrow height (px)

Returns

Promise<void>

setRowVisible(visible)

Shows or hides the rows the range spans. It does nothing when visible is null or undefined.

setRowVisible(visible: boolean): Promise<void>;

Parameters

NameTypeDescription
visiblebooleantrue shows, false hides

Returns

Promise<void>

setValue(value)

Puts the same value into every cell of the range. The value is converted to a string and then interpreted, so it becomes a formula when it starts with "=", and an array formula covering the whole range when it has the form "{=...}". When the range is a single cell inside an existing array formula area, that whole area is entered again. An array formula cannot be put into a merged cell or a table area. null becomes an empty cell, an object is entered in JSON notation, and an object with a string representation such as Date is entered as that string. An array converts each element by the same rules and joins them with commas.

setValue(value: string | number | boolean | null | Date | Record<string, unknown> | any[]): Promise<void>;

Parameters

NameTypeDescription
valuestring | number | boolean | null | Date | Record<string, unknown> | any[]value to put in; a value with no obtainable string representation, such as a self-referencing array or object, cannot be used

Returns

Promise<void>

setValues(values)

Puts a different value into each cell of the range. The outer array index maps to rows within the range and the inner array index to columns, and the size must match the range exactly. Each value is interpreted as in setValue, but an array formula cannot be used. null and undefined become empty cells. It cannot be used on whole-row or whole-column ranges.

setValues(values: (string | number | boolean | null | undefined | Date | Record<string, unknown> | any[])[][]): Promise<void>;

Parameters

NameTypeDescription
values(string | number | boolean | null | undefined | Date | Record<string, unknown> | any[])[][]row-major two-dimensional array the same size as the range

Returns

Promise<void>

setVerticalAlign(value)

Sets the vertical alignment of the range. A value outside VerticalAlign is stored without validation; "distributed" is drawn centered and any other value is drawn at the bottom.

setVerticalAlign(value: VerticalAlign): Promise<void>;

Parameters

NameTypeDescription
valueVerticalAlignVertical alignment

Returns

Promise<void>

setWrapText(isOn)

Applies or removes text wrapping on the range.

setWrapText(isOn: boolean): Promise<void>;

Parameters

NameTypeDescription
isOnbooleantrue applies it, false removes it

Returns

Promise<void>

sort(key, order, options)

Sorts the range by the values of the given column. When the range is a single cell inside a filter or table area, it is handled as that filter's sort and the sort state stays in the document. A header row is detected automatically. It cannot sort when there is no value to sort, or when the merges inside the range differ in size.

sort(key: number, order: SortOrder, options?: Record<string, unknown>): Promise<void>;

Parameters

NameTypeDescription
keynumbercolumn to sort by; a 0-based offset counted from the first column of the range, which cannot exceed the range width
orderSortOrdersort direction; it accepts only the ascending and descending values of SortOrder
options (optional)Record<string, unknown>reserved argument that is not supported yet; passing an object with values in it skips the sort

Returns

Promise<void>

unmerge()

Releases every merge that overlaps the range.

unmerge(): Promise<void>;

Returns

Promise<void>