# Tables operations

> Table structure, layout, styling, and cell operations.



48 operations. Names, descriptions, and behavior flags come from the canonical contract.

## Operations

- [`tables.convertFromText`](/document-api/reference/tables/convert-from-text) (mutates): Convert a text range into a table.
- [`tables.delete`](/document-api/reference/tables/delete) (mutates, tracked): Delete the target table from the document.
- [`tables.clearContents`](/document-api/reference/tables/clear-contents) (mutates): Clear the contents of the target table or cell range.
- [`tables.move`](/document-api/reference/tables/move) (mutates): Move a table to a new position in the document.
- [`tables.split`](/document-api/reference/tables/split) (mutates): Split a table into two tables at the target row.
- [`tables.convertToText`](/document-api/reference/tables/convert-to-text) (mutates): Convert a table back to plain text.
- [`tables.setLayout`](/document-api/reference/tables/set-layout) (mutates, tracked): Set the layout mode of the target table.
- [`tables.insertRow`](/document-api/reference/tables/insert-row) (mutates, tracked): Insert a new row into the target table. The new row is cloned from an adjacent row, so it inherits the existing cell shading, borders, alignment, and padding. No follow-up styling call is needed unless the new row should look different from the rest of the table.
- [`tables.deleteRow`](/document-api/reference/tables/delete-row) (mutates, tracked): Delete a row from the target table.
- [`tables.moveRow`](/document-api/reference/tables/move-row) (mutates): Move a row to a new position within the same table. Available on v2-backed sessions only; v1-backed sessions currently return `CAPABILITY_UNAVAILABLE`.
- [`tables.setRowHeight`](/document-api/reference/tables/set-row-height) (mutates): Set the height of a table row.
- [`tables.distributeRows`](/document-api/reference/tables/distribute-rows) (mutates): Distribute row heights evenly across the target table.
- [`tables.setRowOptions`](/document-api/reference/tables/set-row-options) (mutates): Set options on a table row such as header repeat or page break.
- [`tables.insertColumn`](/document-api/reference/tables/insert-column) (mutates, tracked): Insert a new column into the target table. The new column is cloned from an adjacent column, so it inherits the existing cell shading, borders, alignment, and width. No follow-up styling call is needed unless the new column should look different from the rest of the table.
- [`tables.deleteColumn`](/document-api/reference/tables/delete-column) (mutates, tracked): Delete a column from the target table.
- [`tables.setColumnWidth`](/document-api/reference/tables/set-column-width) (mutates): Set the width of a table column.
- [`tables.distributeColumns`](/document-api/reference/tables/distribute-columns) (mutates): Distribute column widths evenly across the target table.
- [`tables.insertCell`](/document-api/reference/tables/insert-cell) (mutates): Insert a new cell into a table row.
- [`tables.deleteCell`](/document-api/reference/tables/delete-cell) (mutates): Delete a cell from a table row.
- [`tables.mergeCells`](/document-api/reference/tables/merge-cells) (mutates): Merge a range of table cells into one.
- [`tables.unmergeCells`](/document-api/reference/tables/unmerge-cells) (mutates): Unmerge a previously merged table cell.
- [`tables.splitCell`](/document-api/reference/tables/split-cell) (mutates): Split a table cell into multiple cells.
- [`tables.setCellProperties`](/document-api/reference/tables/set-cell-properties) (mutates): Set non-text properties on a single table cell: vertical alignment, text wrapping, fit-text, or preferred width. Requires a cell-level target (a tableCell block address with kind, nodeType, nodeId). Does NOT accept a table target with rowIndex/columnIndex. To set the text content of a cell, use action "set_cell_text" instead.
- [`tables.setCellText`](/document-api/reference/tables/set-cell-text) (mutates): Replace the text content of a single table cell with plain text (one paragraph). Accepts either a direct cell locator (a tableCell block address with kind, nodeType, nodeId) OR a table target with rowIndex + columnIndex. Cell properties (vertical alignment, shading, borders, colspan/rowspan) are preserved. Use this for filling cells with values, replacing cell text, or populating empty tables. Much simpler than walking paragraphs and runs through superdoc_edit.
- [`tables.sort`](/document-api/reference/tables/sort) (mutates): Sort table rows by a column value.
- [`tables.setAltText`](/document-api/reference/tables/set-alt-text) (mutates): Set the alternative text description for a table.
- [`tables.setStyle`](/document-api/reference/tables/set-style) (mutates): Apply a named table style to the target table, or clear the style when styleId is omitted.
- [`tables.clearStyle`](/document-api/reference/tables/clear-style) (mutates): Remove the applied table style, reverting to defaults.
- [`tables.setStyleOption`](/document-api/reference/tables/set-style-option) (mutates): Toggle a conditional style option such as banded rows or first column.
- [`tables.setBorder`](/document-api/reference/tables/set-border) (mutates): Set border properties on a table or cell range.
- [`tables.clearBorder`](/document-api/reference/tables/clear-border) (mutates): Remove border formatting from a table or cell range.
- [`tables.applyBorderPreset`](/document-api/reference/tables/apply-border-preset) (mutates): Apply a border preset (e.g. all borders, outside only) to a table.
- [`tables.setShading`](/document-api/reference/tables/set-shading) (mutates): Set the background shading color on a table or cell range.
- [`tables.clearShading`](/document-api/reference/tables/clear-shading) (mutates): Remove shading from a table or cell range.
- [`tables.setTablePadding`](/document-api/reference/tables/set-table-padding) (mutates): Set default cell padding for the entire table.
- [`tables.setCellPadding`](/document-api/reference/tables/set-cell-padding) (mutates): Set padding on a specific table cell or cell range.
- [`tables.setCellSpacing`](/document-api/reference/tables/set-cell-spacing) (mutates): Set the cell spacing for the target table.
- [`tables.clearCellSpacing`](/document-api/reference/tables/clear-cell-spacing) (mutates): Remove custom cell spacing from the target table.
- [`tables.applyStyle`](/document-api/reference/tables/apply-style) (mutates): Toggle conditional-format flags (header row, banded rows/columns, first/last column, last row) on a table. Pass `styleOptions` with the flags you want to set or clear (omitted flags stay unchanged). For "format the first row as a header" use `styleOptions: { headerRow: true }`. Optional `styleId` applies a named table style. Leave it unset unless you have a styleId from `superdoc_get_content` (no need to invent one).
- [`tables.setBorders`](/document-api/reference/tables/set-borders) (mutates): Set borders on a table using a target set or per-edge patch.
- [`tables.setTableOptions`](/document-api/reference/tables/set-table-options) (mutates): Set table-level default cell margins and/or cell spacing.
- [`tables.applyPreset`](/document-api/reference/tables/apply-preset) (mutates): Apply a named visual preset to a table. Presets: "grid" (1pt black borders all around), "minimal" (no outer borders, hairline grey row separators + thicker bottom), "striped" (banded rows on, 0.5pt grey borders), "accent" (filled header row + thick accent top/bottom; defaults to dark blue, override with `accentColor`). Composes set_borders + set_style_options + header-row shading in one call. Available via the document API and `superdoc_mutations` (intentionally NOT exposed as a top-level action on `superdoc_table`. Agents should compose explicit set_borders / set_shading / set_style_options calls so they always pick concrete colors that match the document context).
- [`tables.get`](/document-api/reference/tables/get) (read): Retrieve table structure and dimensions by locator.
- [`tables.getCells`](/document-api/reference/tables/get-cells) (read): Retrieve cell information for a table, optionally filtered by row or column.
- [`tables.getProperties`](/document-api/reference/tables/get-properties) (read): Retrieve layout and style properties of a table.
- [`tables.getStyles`](/document-api/reference/tables/get-styles) (read): List all table styles and the document-level default table style setting.
- [`tables.setDefaultStyle`](/document-api/reference/tables/set-default-style) (mutates): Set the document-level default table style (w:defaultTableStyle in settings.xml).
- [`tables.clearDefaultStyle`](/document-api/reference/tables/clear-default-style) (mutates): Remove the document-level default table style setting.

