> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reducto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Other classes: Tables

## `TableColumnCollection`

`Excel.TableColumnCollection`.

Import from `@reductoai/xlsx/officejs`.

### TableColumnCollection properties

| Name | Type | Description |
| - | - | - |
| `count` | `number` | read-only |
| `items` | `TableColumn[]` | read-only |

### `TableColumnCollection.add()`

```ts theme={null}
add(index?: number | null, values?: unknown[][], name?: string): TableColumn
```

Inserts a column at `index` (the end when omitted); `values` fill it top to bottom, header first.

### `TableColumnCollection.addAsJson()`

```ts theme={null}
addAsJson(index?: number | null, values?: unknown[][], name?: string): TableColumn
```

`add` with `CellValue` objects; each cell takes its `basicValue`.

### `TableColumnCollection.getCount()`

```ts theme={null}
getCount(): ClientResult<number>
```

### `TableColumnCollection.getItem()`

```ts theme={null}
getItem(key: string | number): TableColumn
```

By name or by id.

### `TableColumnCollection.getItemAt()`

```ts theme={null}
getItemAt(index: number): TableColumn
```

### `TableColumnCollection.getItemOrNullObject()`

```ts theme={null}
getItemOrNullObject(key: string | number): Nullable<TableColumn>
```

## `TableRowCollection`

`Excel.TableRowCollection`: the data rows.

Import from `@reductoai/xlsx/officejs`.

### TableRowCollection properties

| Name | Type | Description |
| - | - | - |
| `count` | `number` | read-only |
| `items` | `TableRow[]` | read-only |

### `TableRowCollection.add()`

```ts theme={null}
add(index?: number | null, values?: unknown[][]): TableRow
```

Inserts one row per row of `values` (one blank row without) at `index`, the end when omitted.

### `TableRowCollection.addAsJson()`

```ts theme={null}
addAsJson(index?: number | null, values?: unknown[][], alwaysInsert?: boolean): TableRow
```

`add` with `CellValue` objects. `alwaysInsert` false writes below the table, which then grows over the rows.

### `TableRowCollection.deleteRows()`

```ts theme={null}
deleteRows(rows: (number | TableRow)[]): void
```

Deletes data rows by index or handle, all against the indexes before the call.

### `TableRowCollection.deleteRowsAt()`

```ts theme={null}
deleteRowsAt(index: number, count?: number): void
```

Deletes `count` data rows from `index` on.

### `TableRowCollection.getCount()`

```ts theme={null}
getCount(): ClientResult<number>
```

### `TableRowCollection.getItemAt()`

```ts theme={null}
getItemAt(index: number): TableRow
```

## `TableScopedCollection`

`Excel.TableScopedCollection`: the tables a range overlaps, or holds whole.

Not exported by name. You get it from the API.

### TableScopedCollection properties

| Name | Type | Description |
| - | - | - |
| `count` | `number` | read-only |
| `items` | `ExcelTable[]` | read-only |

### `TableScopedCollection.getCount()`

```ts theme={null}
getCount(): ClientResult<number>
```

### `TableScopedCollection.getFirst()`

```ts theme={null}
getFirst(): ExcelTable
```

The table nearest the top-left; throws when there is none.

### `TableScopedCollection.getFirstOrNullObject()`

```ts theme={null}
getFirstOrNullObject(): Nullable<ExcelTable>
```

### `TableScopedCollection.getItem()`

```ts theme={null}
getItem(key: string): ExcelTable
```

### `TableScopedCollection.getItemOrNullObject()`

```ts theme={null}
getItemOrNullObject(key: string): Nullable<ExcelTable>
```

## `TableSort`

`Excel.TableSort`.

Import from `@reductoai/xlsx/officejs`.

### TableSort properties

| Name | Type | Description |
| - | - | - |
| `fields` | `SortField[]` | read-only The levels of the last sort applied; `key` counts from the table's first column. |
| `matchCase` | `boolean` | read-only |
| `method` | `SortMethod` | read-only |

### `TableSort.apply()`

```ts theme={null}
apply(fields: SortField[], matchCase?: boolean, method?: SortMethod): void
```

Sorts the shown rows by `fields`, the first one outermost.

### `TableSort.clear()`

```ts theme={null}
clear(): void
```

Forgets the sort, as the header buttons show it; the rows keep their order.

### `TableSort.reapply()`

```ts theme={null}
reapply(): void
```

Reapplies the filters, as Excel's Reapply does after a sort.

## `TableStyle`

A table, pivot, slicer or timeline style: built-in ones are read-only.

Import from `@reductoai/xlsx/officejs`.

### TableStyle properties

| Name | Type | Description |
| - | - | - |
| `name` | `string` | |
| `readOnly` | `boolean` | read-only |

### `TableStyle.delete()`

```ts theme={null}
delete(): void
```

### `TableStyle.duplicate()`

```ts theme={null}
duplicate(): this
```

A copy named "\<name> 2"; a built-in table or pivot style copies its formats.

### `TableStyle.set()`

```ts theme={null}
set(properties: Record<string, unknown>, options?: UpdateOptions): void
```

## `TableStyleCollection`

The styles of one kind: built-in ones, then the workbook's own.

Import from `@reductoai/xlsx/officejs`.

### TableStyleCollection properties

| Name | Type | Description |
| - | - | - |
| `items` | `StyleOf<K>[]` | read-only |

### `TableStyleCollection.add()`

```ts theme={null}
add(name: string, makeUniqueName?: boolean): TableStyle
```

A blank style; `makeUniqueName` numbers a name already in use instead of throwing.

### `TableStyleCollection.getCount()`

```ts theme={null}
getCount(): ClientResult<number>
```

### `TableStyleCollection.getDefault()`

```ts theme={null}
getDefault(): TableStyle
```

### `TableStyleCollection.getItem()`

```ts theme={null}
getItem(name: string): TableStyle
```

### `TableStyleCollection.getItemOrNullObject()`

```ts theme={null}
getItemOrNullObject(name: string): Nullable<TableStyle>
```

### `TableStyleCollection.setDefault()`

```ts theme={null}
setDefault(newDefaultStyle: string | TableStyle): void
```
