Skip to main content

Cell.Table

Cell.Table is an object type of the Spreadsheet module (Office.cell(iframe)). 9 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

  • Module: Spreadsheet · Office.cell(iframe) · namespace Cell
  • Obtained from: Workbook.getTable(name), Worksheet.addTable(dataRange, hasHeaders)
  • Navigation methods (getFilter(), getRange()) return a child handle synchronously without a round trip; the request is sent by the next terminal call. Every other method returns a Promise.

Methods

MethodDescription
delete()Deletes the table.
getFilter()Returns the auto-filter handle of this table.
getInfo()Returns the table's name, position, area, and display options at once.
getName()Returns the table name as set.
getOptions()Returns the display options of the table at once.
getRange()Returns a Range handle for the whole table area, header row and total row included.
resize(range)Changes the table area to a new range.
setName(name)Changes the table name.
setOptions(options)Changes the display options of the table.

Method details

delete()

Deletes the table. It removes the table definition and the auto filter attached to it, and clears the cell content of the table area as well.

delete(): Promise<void>;

Returns

Promise<void>

getFilter()

Returns the auto-filter handle of this table. Filtering is inherent to a table's structure, so a handle is returned even before a filter is created; check whether one exists with the Filter's getInfo().

getFilter(): Filter;

Returns

Filter

getInfo()

Returns the table's name, position, area, and display options at once.

getInfo(): Promise<TableInfo>;

Returns

Promise<TableInfo>

getName()

Returns the table name as set.

getName(): Promise<string>;

Returns

Promise<string>

getOptions()

Returns the display options of the table at once.

getOptions(): Promise<TableOptions>;

Returns

Promise<TableOptions>

getRange()

Returns a Range handle for the whole table area, header row and total row included. The returned Range carries the coordinates as of the call, so it does not follow later changes to the table area.

getRange(): Range;

Returns

Range

resize(range)

Changes the table area to a new range. The new area must keep the header row where it is, must overlap the current table area, must span at least two cells, and cannot be whole rows or whole columns. Passing the current area changes nothing.

resize(range: string | RangeCoords): Promise<void>;

Parameters

NameTypeDescription
rangestring | RangeCoordsnew table area; an A1-notation string also works ("A1:B2", or "E10" for a single cell)

Returns

Promise<void>

setName(name)

Changes the table name. Formulas that reference the table name are updated to the new name. This handle points at the new name and stays usable, but other handles for the same table and any Filter handle taken from it earlier can no longer be used. It cannot be changed when another table already uses the name, matched case-insensitively.

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

Parameters

NameTypeDescription
namestringnew table name; it cannot contain spaces or disallowed characters, and a name that reads as a cell reference or exceeds the maximum length is rejected

Returns

Promise<void>

setOptions(options)

Changes the display options of the table. Only the options you give are applied and the rest keep their current values. When the header row or total row is turned on and the adjacent row just outside the table is not empty, a row is inserted into the sheet and the content below is pushed down; turning it off clears the cell values of that row. Turning the header row on also creates the table's auto filter, and turning it off removes it. The table style cannot be changed with this method.

setOptions(options: TableOptionUpdate): Promise<void>;

Parameters

NameTypeDescription
optionsTableOptionUpdateoptions to change

Returns

Promise<void>