Skip to content
Spreadsheet Engine

TableManager

Manages every Table in a workbook. Access via workbook.tables.

Provides table-level CRUD (get, getAll, add, delete) and keeps table refs and structured references consistent when the underlying sheet geometry changes (row/column insertion or deletion).

Table names share a namespace with defined names: a name that is already in use as a defined name cannot be used for a table, and vice versa.

  • TableHost
new TableManager(workbook): TableManager;

Workbook

TableManager

iterator: IterableIterator<Table>;

IterableIterator<Table>


add(jsfTable): Table;

Create and register a new table from a JSF table definition. Throws on validation failure (invalid name, invalid ref, name collision).

Table

Table


adjustTableForColEdit(
table,
atCol,
count): boolean;

Adjust one table’s ref and column definitions after columns are inserted or deleted on its sheet, adding default-named columns when an insertion expands the table, dropping column definitions when a deletion overlaps it, and removing the table when the deletion swallows it entirely.

Table

number

0-based column where the structural edit starts

number

Positive for insertion, negative for deletion.

boolean

true if the table’s ref was adjusted or the table was removed.


adjustTableForRowEdit(
table,
atRow,
count): boolean;

Adjust one table’s ref after rows are inserted or deleted on its sheet, shrinking its header/totals row counts when a deletion overlaps them and removing the table when the deletion swallows it entirely.

Table

number

0-based row where the structural edit starts

number

Positive for insertion, negative for deletion.

boolean

true if the table’s ref was adjusted or the table was removed.


adjustTableRefsForColMove(
sheetName,
from,
to,
count): void;

Adjust table refs after a reorderColumns operation. Column-axis mirror of adjustTableRefsForRowMove.

string

number

number

number

void


adjustTableRefsForColShift(
sheetName,
atCol,
count): boolean;

Adjust table refs (and column definitions) after columns are inserted or deleted on a sheet. Mirrors adjustTableRefsForRowShift but along the column axis.

string

number

0-based column where the edit starts

number

Positive for insertion, negative for deletion.

boolean

true if any table’s ref was adjusted or any table was removed, in which case a recalculation is in order.


adjustTableRefsForMove(fromRef, toRef): void;

After a moveCells operation, update the refs of any tables that were fully contained within the source range. Tables only partially overlapping the source, or at the destination, are not affected --- matching Excel’s behavior.

A1Reference

A1Reference

void


adjustTableRefsForRowMove(
sheetName,
from,
to,
count): void;

Adjust table refs after a reorderRows operation. The three-step insert/move/delete sequence in reorderRowsOrColumns has already moved cells; this adjusts table refs to match the net effect:

  • Tables fully within the source [from, from+count) move by to − from.
  • Tables fully within the displaced range shift by ±count.
  • Partially overlapping tables are left unchanged.

string

number

0-based index of the first row that was moved

number

0-based index where the first row ended up

number

number of rows moved

void


adjustTableRefsForRowShift(
sheetName,
atRow,
count,
options?): boolean;

Adjust table refs after rows are inserted or deleted on a sheet.

string

number

0-based row where the structural edit starts

number

Positive for insertion (shift down), negative for deletion (rows atRow..atRow+|count|-1 removed, remaining shift up).

Table

A table to skip (the one performing the edit).

number

/ rightCol When provided, only tables whose columns are fully contained within [leftCol, rightCol] are affected (for column-scoped shifts such as Table.insertRow). Tables that only partially overlap are skipped to avoid misaligning their non-shifted columns.

number

boolean

true if any table’s ref was adjusted or any table was removed, in which case a recalculation is in order.

TableHost.adjustTableRefsForRowShift

delete(name, options?): boolean;

Remove a table by name. Returns false if the table does not exist. By default only the table definition is removed; cell data is left intact. Pass { clearData: true } to also clear cell contents in the table’s range.

string

boolean

boolean


get(name): Table | null;

Look up a table by name (case-insensitive).

string

Table | null


getAll(): Table[];

Return all tables in the workbook.

Table[]


getIntersecting(sheetName, range): Table[];

Return the tables on sheetName whose range intersects range.

string

SlimRange

Table[]