Skip to content

Work with tables ​

Use this when a range of records should behave as an Excel table: formulas address its columns by name, and the table grows with its data.

Create a table ​

Write the header and the data first, then call ws.addTable({ range, name, columns }) (Python add_table(TableInput(...))). The call returns a Table handle.

  • With a header row the column names are read from the header cells. An empty header cell takes the profile's column word and a number (Column2, 列2).
  • columns, when given, must match every header cell that holds text, and an empty one receives its name.
  • A range of only the header row gets one blank data row below it, and occupied cells in the table's columns move down. On the last row of the grid the call throws StatusCode.PreconditionFailed.
js
import createFormulon from '@libraz/formulon'

const formulon = await createFormulon()
const wb = formulon.Workbook.createDefault()
try {
  const ws = wb.sheet(0)
  ws.setValues('A1', [['Region', 'Sales'], ['East', 120], ['West', 90]])
  const table = ws.addTable({ range: 'A1:B3', name: 'Sales', columns: ['Region', 'Sales'] })

  const props = table.getProperties()
  console.log(table.name, props.headerRow, props.columns.map((c) => c.name).join()) // Sales true Region,Sales
  console.log(table.getStyleOptions().styleName) // TableStyleMedium2
} finally {
  wb.dispose()
}
python
from formulon import TableInput, Workbook

with Workbook.create_default() as wb:
    ws = wb[0]
    ws["A1:B3"] = [["Region", "Sales"], ["East", 120], ["West", 90]]
    table = ws.add_table(TableInput(range="A1:B3", name="Sales", columns=["Region", "Sales"]))

    props = table.get_properties()
    print(table.name, props.header_row, ",".join(c.name for c in props.columns))  # Sales True Region,Sales
    print(table.get_style_options().style_name)  # TableStyleMedium2

A table name follows Excel's rules: it cannot look like a cell address, contain a space or collide with another table or defined name. A range that overlaps another table, a PivotTable or an array formula is refused with StatusCode.PreconditionFailed.

Refer to the table in formulas ​

A structured reference names the table and a column: Sales[Sales] is the data of the Sales column, and Sales alone is the whole data body. The references follow the table when it moves or grows, and a rename rewrites them.

The rows of a table with a totals row

The table Sales covers A1:B4. Sales[#All] is all of A1:B4, Sales[#Headers] is the header row A1:B1, Sales[#Data] (or Sales alone) is the data body A2:B3, and Sales[#Totals] is the totals row A4:B4. Sales[Sales] is B2:B3, and Sales[@Sales] in a formula on row 3 is B3. Sales[#Totals] returns #REF! while the totals row is off, and Sales[#Headers] while the header row is off.

Powered by the real Formulon engine (WASM) — it runs entirely in your browser, nothing is uploaded.

js
import createFormulon from '@libraz/formulon'

const formulon = await createFormulon()
const wb = formulon.Workbook.createDefault()
try {
  const ws = wb.sheet(0)
  ws.setValues('A1', [['Region', 'Sales'], ['East', 120], ['West', 90]])
  const table = ws.addTable({ range: 'A1:B3', name: 'Sales', columns: ['Region', 'Sales'] })
  ws.setFormula('D1', '=SUM(Sales[Sales])')
  ws.setFormula('D2', '=ROWS(Sales)')
  ws.setFormula('D3', '=XLOOKUP("West",Sales[Region],Sales[Sales])')

  console.log(ws.getValue('D1'), ws.getValue('D2'), ws.getValue('D3')) // 210 2 90

  table.rename('Revenue')
  console.log(ws.getFormula('D1')) // =SUM(Revenue[Sales])
} finally {
  wb.dispose()
}
python
from formulon import TableInput, Workbook

with Workbook.create_default() as wb:
    ws = wb[0]
    ws["A1:B3"] = [["Region", "Sales"], ["East", 120], ["West", 90]]
    table = ws.add_table(TableInput(range="A1:B3", name="Sales", columns=["Region", "Sales"]))
    ws.set_formula("D1", "=SUM(Sales[Sales])")
    ws.set_formula("D2", "=ROWS(Sales)")
    ws.set_formula("D3", '=XLOOKUP("West",Sales[Region],Sales[Sales])')

    print(ws["D1"], ws["D2"], ws["D3"])  # 210.0 2.0 90.0

    table.rename("Revenue")
    print(ws.get_formula("D1"))  # =SUM(Revenue[Sales])

Add a totals row ​

table.update({ totalsRow: true }) (Python update(totals_row=True)) adds a row below the table and grows its range by one.

The first time a table shows its totals row, the engine fills in Excel's defaults:

  • A label in the first column in the profile's language (Total, 集計).
  • In the last column, Sum when every data cell is a number that is not a date, otherwise Count.
  • A one-column table gets only the function.

A built-in function is written as SUBTOTAL with the 1xx code, so it skips rows a filter hides.

The columns key of a patch changes a column's totals. Element i of columns patches column i, and an omitted key keeps the column's setting. Turning the totals row off keeps each column's settings, and turning it on again restores them; when every column's settings are cleared, the restored row is empty.

js
import createFormulon, { TableTotalsRowFunction } from '@libraz/formulon'

const formulon = await createFormulon()
const wb = formulon.Workbook.createDefault()
try {
  const ws = wb.sheet(0)
  ws.setValues('A1', [['Region', 'Sales'], ['East', 120], ['West', 90]])
  const table = ws.addTable({ range: 'A1:B3', name: 'Sales' })

  table.update({ totalsRow: true })
  console.log(JSON.stringify(ws.getValues('A4:B4'))) // [["Total",210]]
  console.log(ws.getFormula('B4')) // =SUBTOTAL(109,[Sales])

  table.update({ columns: [{}, { totalsRowFunction: TableTotalsRowFunction.Average }] })
  table.update({ totalsRow: false })
  table.update({ totalsRow: true })
  console.log(JSON.stringify(ws.getValues('A4:B4'))) // [["Total",105]]
} finally {
  wb.dispose()
}
python
from formulon import TableColumnPatch, TableInput, TableTotalsRowFunction, Workbook

with Workbook.create_default() as wb:
    ws = wb[0]
    ws["A1:B3"] = [["Region", "Sales"], ["East", 120], ["West", 90]]
    table = ws.add_table(TableInput(range="A1:B3", name="Sales"))

    table.update(totals_row=True)
    print(ws["A4:B4"])  # [['Total', 210.0]]
    print(ws.get_formula("B4"))  # =SUBTOTAL(109,[Sales])

    table.update(columns=[{}, TableColumnPatch(totals_row_function=TableTotalsRowFunction.AVERAGE)])
    table.update(totals_row=False)
    table.update(totals_row=True)
    print(ws["A4:B4"])  # [['Total', 105.0]]

The cells below the table's columns move down one row to make room. When a merge, another table, a PivotTable, a multi-cell array formula or a data table straddles those columns below the table, nothing moves and the row directly below must be free. Otherwise the call throws StatusCode.PreconditionFailed and changes nothing.

update({ totalsRow: false }) removes the row and moves the cells below back up, or only empties it when something straddles the columns below.

columns may be shorter than the table, and {} leaves a column alone; an array longer than the table throws StatusCode.IndexOutOfRange. null (Python None) clears a setting. TableTotalsRowFunction.Custom needs a non-empty totalsRowFormula, and any other function drops the formula. A column's name is not part of the patch; rename it with table.renameColumn.

Writing to a totals-row cell updates its column the way Excel does. Text or a number becomes the label, a SUBTOTAL formula with one of the engine's 1xx codes over the column becomes that function, any other formula (=5 included) becomes Custom with that formula, and clearing the cell sets the function to None.

Turn the header row off and on ​

table.update({ headerRow: false }) (Python update(header_row=False)) deletes the header cells, formatting included, and the table's range loses its top row.

  • The table's AutoFilter goes with them, but the column names are kept, so structured references by column keep working.
  • A reference to the header row (Sales[#Headers], Sales[[#Headers],[Sales]]) reads #REF! while the header row is off.
  • A table with no data row cannot turn its header row off. The call throws StatusCode.PreconditionFailed.

update({ headerRow: true }) writes the names back. When the row above the data is empty within the table's columns, the names go there and the table grows upward. When that row is occupied, or the table starts on the first sheet row, the table's columns move down one row from the first data row, as insertCells with CellShift.Down does, and the names are written into the freed row.

js
import createFormulon from '@libraz/formulon'

const formulon = await createFormulon()
const wb = formulon.Workbook.createDefault()
try {
  const ws = wb.sheet(0)
  ws.setValues('A1', [['Region', 'Sales'], ['East', 120], ['West', 90]])
  const table = ws.addTable({ range: 'A1:B3', name: 'Sales' })
  ws.setFormula('D1', '=Sales[[#Headers],[Sales]]')
  ws.setFormula('D2', '=SUM(Sales[Sales])')

  table.update({ headerRow: false })
  console.log(JSON.stringify(ws.getValues('A1:B1'))) // [[null,null]]
  console.log(ws.getDisplayText('D1').text, ws.getValue('D2')) // #REF! 210

  table.update({ headerRow: true })
  console.log(JSON.stringify(ws.getValues('A1:B1'))) // [["Region","Sales"]]
  console.log(ws.getValue('D1')) // Sales
} finally {
  wb.dispose()
}
python
from formulon import TableInput, Workbook

with Workbook.create_default() as wb:
    ws = wb[0]
    ws["A1:B3"] = [["Region", "Sales"], ["East", 120], ["West", 90]]
    table = ws.add_table(TableInput(range="A1:B3", name="Sales"))
    ws.set_formula("D1", "=Sales[[#Headers],[Sales]]")
    ws.set_formula("D2", "=SUM(Sales[Sales])")

    table.update(header_row=False)
    print(ws["A1:B1"])  # [[None, None]]
    print(ws.get_display_text("D1").text, ws["D2"])  # #REF! 210.0

    table.update(header_row=True)
    print(ws["A1:B1"])  # [['Region', 'Sales']]
    print(ws["D1"])  # Sales

A patch that carries a toggle and range applies the toggles first, the header row and then the totals row, and then checks range and columns against the toggled shape. A range whose first row is not the first row of that shape throws StatusCode.InvalidArgument. A refusal anywhere leaves the whole patch unapplied.

Resize the table ​

Writing below a table does not extend it. table.update({ range }) sets the new rectangle, which keeps the header row where it is. To insert rows or columns and shift the cells below or beside them, use insertRows and insertColumns.

js
import createFormulon from '@libraz/formulon'

const formulon = await createFormulon()
const wb = formulon.Workbook.createDefault()
try {
  const ws = wb.sheet(0)
  ws.setValues('A1', [['Region', 'Sales'], ['East', 120], ['West', 90]])
  const table = ws.addTable({ range: 'A1:B3', name: 'Sales', columns: ['Region', 'Sales'] })
  ws.setFormula('D1', '=SUM(Sales[Sales])')

  ws.setValues('A4', [['North', 50]])
  console.log(ws.getValue('D1')) // 210

  table.update({ range: 'A1:B4' })
  console.log(ws.getValue('D1')) // 260
  console.log(table.getProperties().range.rect.lastRow) // 3
} finally {
  wb.dispose()
}
python
from formulon import TableInput, Workbook

with Workbook.create_default() as wb:
    ws = wb[0]
    ws["A1:B3"] = [["Region", "Sales"], ["East", 120], ["West", 90]]
    table = ws.add_table(TableInput(range="A1:B3", name="Sales", columns=["Region", "Sales"]))
    ws.set_formula("D1", "=SUM(Sales[Sales])")

    ws["A4:B4"] = [["North", 50]]
    print(ws["D1"])  # 210.0

    table.update(range="A1:B4")
    print(ws["D1"])  # 260.0
    print(table.get_properties().range.rect.last_row)  # 3

Insert rows and columns into a table ​

table.insertRows(first?, last?) (Python insert_rows) inserts data rows as Excel's table row insert does: only the cells of the table's columns move down, the table grows by the span, and structured references, the AutoFilter and the totals row follow. first and last are 0-based positions among the data rows, not sheet rows. Called with no argument it appends one row, above the totals row when there is one.

To watch the table range and a [#Totals] reference change as you insert a row, try the table demo.

js
import createFormulon from '@libraz/formulon'

const formulon = await createFormulon()
const wb = formulon.Workbook.createDefault()
try {
  const ws = wb.sheet(0)
  ws.setValues('A1', [['Region', 'Sales'], ['East', 120], ['West', 90]])
  const table = ws.addTable({ range: 'A1:B3', name: 'Sales' })
  table.update({ totalsRow: true }) // the totals row is row 4
  ws.setFormula('D1', '=SUBTOTAL(109,Sales[Sales])')

  table.insertRows()
  ws.setValues('A4', [['North', 50]])

  const props = table.getProperties()
  console.log(props.totalsRow, props.range.rect.lastRow) // true 4
  console.log(ws.getValue('D1')) // 260
} finally {
  wb.dispose()
}
python
from formulon import TableInput, Workbook

with Workbook.create_default() as wb:
    ws = wb[0]
    ws["A1:B3"] = [["Region", "Sales"], ["East", 120], ["West", 90]]
    table = ws.add_table(TableInput(range="A1:B3", name="Sales"))
    table.update(totals_row=True)  # the totals row is row 4
    ws.set_formula("D1", "=SUBTOTAL(109,Sales[Sales])")

    table.insert_rows()
    ws["A4:B4"] = [["North", 50]]

    props = table.get_properties()
    print(props.totals_row, props.range.rect.last_row)  # True 4
    print(ws["D1"])  # 260.0

Inserting in the middle moves the rows below the insertion point, and every formula that pointed at them, whether by A1 address or by structured reference, follows. A cell outside the table's columns stays where it is.

js
import createFormulon from '@libraz/formulon'

const formulon = await createFormulon()
const wb = formulon.Workbook.createDefault()
try {
  const ws = wb.sheet(0)
  ws.setValues('A1', [['Region', 'Sales'], ['East', 120], ['West', 90]])
  const table = ws.addTable({ range: 'A1:B3', name: 'Sales' })
  ws.setFormula('D1', '=SUM(Sales[Sales])')
  ws.setFormula('D2', '=B3')
  ws.setFormula('D3', '=SUM(B2:B3)')

  table.insertRows(1, 2) // two data rows before "West"
  ws.setValues('A3', [['North', 50], ['South', 40]])

  console.log(ws.getFormula('D2'), ws.getValue('D2')) // =B5 90
  console.log(ws.getFormula('D3'), ws.getValue('D3')) // =SUM(B2:B5) 300
  console.log(ws.getValue('D1')) // 300
} finally {
  wb.dispose()
}
python
from formulon import TableInput, Workbook

with Workbook.create_default() as wb:
    ws = wb[0]
    ws["A1:B3"] = [["Region", "Sales"], ["East", 120], ["West", 90]]
    table = ws.add_table(TableInput(range="A1:B3", name="Sales"))
    ws.set_formula("D1", "=SUM(Sales[Sales])")
    ws.set_formula("D2", "=B3")
    ws.set_formula("D3", "=SUM(B2:B3)")

    table.insert_rows(1, 2)  # two data rows before "West"
    ws["A3:B4"] = [["North", 50], ["South", 40]]

    print(ws.get_formula("D2"), ws["D2"])  # =B5 90.0
    print(ws.get_formula("D3"), ws["D3"])  # =SUM(B2:B5) 300.0
    print(ws["D1"])  # 300.0

The new rows are blank, except in a calculated column, whose formula is written into each new row. A column becomes calculated when update gives it a calculatedFormula, and getProperties().columns[i].calculatedFormula reads it back. A formula typed into a single new row is not copied down the column, so a host that wants Excel's autofill writes the column formula itself.

js
import createFormulon from '@libraz/formulon'

const formulon = await createFormulon()
const wb = formulon.Workbook.createDefault()
try {
  const ws = wb.sheet(0)
  ws.setValues('A1', [['Item', 'Qty', 'Price', 'Total'], ['Pen', 2, 1.5, null], ['Ink', 1, 4, null]])
  const table = ws.addTable({ range: 'A1:D3', name: 'Orders' })
  table.update({ columns: [{}, {}, {}, { calculatedFormula: '=[@Qty]*[@Price]' }] })
  console.log(ws.getValue('D2'), ws.getValue('D3')) // 3 4

  table.insertRows()
  ws.setValues('A4', [['Pad', 3, 2]])

  console.log(ws.getFormula('D4'), ws.getValue('D4')) // =[@Qty]*[@Price] 6
  console.log(table.getProperties().columns[3].calculatedFormula) // =[@Qty]*[@Price]
} finally {
  wb.dispose()
}
python
from formulon import TableColumnPatch, TableInput, Workbook

with Workbook.create_default() as wb:
    ws = wb[0]
    ws["A1:D3"] = [["Item", "Qty", "Price", "Total"], ["Pen", 2, 1.5, None], ["Ink", 1, 4, None]]
    table = ws.add_table(TableInput(range="A1:D3", name="Orders"))
    table.update(columns=[{}, {}, {}, TableColumnPatch(calculated_formula="=[@Qty]*[@Price]")])
    print(ws["D2"], ws["D3"])  # 3.0 4.0

    table.insert_rows()
    ws["A4:C4"] = [["Pad", 3, 2]]

    print(ws.get_formula("D4"), ws["D4"])  # =[@Qty]*[@Price] 6.0
    print(table.get_properties().columns[3].calculated_formula)  # =[@Qty]*[@Price]

A calculatedFormula that differs from the column's current one fills every data cell, constants included. Setting the same formula again changes nothing, so a constant typed into the column stays. null (Python None) removes the calculated-column mark and leaves the cells as they are.

table.insertColumns(first?, last?) inserts table columns the same way. first and last are positions among the table's columns, and with no argument one column is appended after the last. A new column is named from its left neighbour (Q2 gives Q3), otherwise the profile's Column<N>, and the name is written to the header cell.

js
import createFormulon from '@libraz/formulon'

const formulon = await createFormulon()
const wb = formulon.Workbook.createDefault()
try {
  const ws = wb.sheet(0)
  ws.setValues('A1', [['Region', 'Sales'], ['East', 120], ['West', 90]])
  const table = ws.addTable({ range: 'A1:B3', name: 'Sales' })
  ws.setFormula('E1', '=SUM(Sales[Sales])')
  ws.setFormula('E2', '=SUM(B2:B3)')

  table.insertColumns(1)
  ws.setValues('B2', [['Q1'], ['Q2']])

  console.log(JSON.stringify(ws.getValues('A1:C1'))) // [["Region","Column1","Sales"]]
  console.log(ws.getFormula('F2'), ws.getValue('F1')) // =SUM(C2:C3) 210
  console.log(table.getProperties().columns.map((c) => c.name).join()) // Region,Column1,Sales
} finally {
  wb.dispose()
}
python
from formulon import TableInput, Workbook

with Workbook.create_default() as wb:
    ws = wb[0]
    ws["A1:B3"] = [["Region", "Sales"], ["East", 120], ["West", 90]]
    table = ws.add_table(TableInput(range="A1:B3", name="Sales"))
    ws.set_formula("E1", "=SUM(Sales[Sales])")
    ws.set_formula("E2", "=SUM(B2:B3)")

    table.insert_columns(1)
    ws["B2:B3"] = [["Q1"], ["Q2"]]

    print(ws["A1:C1"])  # [['Region', 'Column1', 'Sales']]
    print(ws.get_formula("F2"), ws["F1"])  # =SUM(C2:C3) 210.0
    print(",".join(c.name for c in table.get_properties().columns))  # Region,Column1,Sales

The formulas in column E sat to the right of the table's rows, so they moved with them into column F.

Failures of an insert:

ConditionResult
first negative or past the end of the tableStatusCode.IndexOutOfRange (Python IndexOutOfRangeError)
last below firstStatusCode.InvalidArgument
last without firstTypeError
A fractional positionRangeError (Python TypeError)
An insert that would push a value, an array formula or the table itself past the last sheet row, or that cuts through a PivotTable or a data tableStatusCode.PreconditionFailed; nothing changes
js
import createFormulon, { StatusCode, enumName } from '@libraz/formulon'

const formulon = await createFormulon()
const wb = formulon.Workbook.createDefault()
try {
  const ws = wb.sheet(0)
  ws.setValues('A1', [['Region', 'Sales'], ['East', 120], ['West', 90]])
  const table = ws.addTable({ range: 'A1:B3', name: 'Sales' })

  for (const attempt of [() => table.insertRows(5), () => table.insertRows(1.5)]) {
    try {
      attempt()
    } catch (e) {
      console.log(e instanceof formulon.FormulonError ? enumName(StatusCode, e.code) : e.name)
    }
  }
  console.log(table.getProperties().range.rect.lastRow)
} finally {
  wb.dispose()
}
// IndexOutOfRange
// RangeError
// 2
python
from formulon import IndexOutOfRangeError, TableInput, Workbook

with Workbook.create_default() as wb:
    ws = wb[0]
    ws["A1:B3"] = [["Region", "Sales"], ["East", 120], ["West", 90]]
    table = ws.add_table(TableInput(range="A1:B3", name="Sales"))

    for attempt in (lambda: table.insert_rows(5), lambda: table.insert_rows(1.5)):
        try:
            attempt()
        except (IndexOutOfRangeError, TypeError) as e:
            print(type(e).__name__)
    print(table.get_properties().range.rect.last_row)
# IndexOutOfRangeError
# TypeError
# 2

Create the table below, switch its header row and totals row, and insert a row to see the table range and Sales[[#Totals],[Sales]] follow.

Table rows and totals

Change the table Sales in A1:B4 the way Excel's Table Design tab does: turn the header row and the total row on or off, and insert a table row above the selected data row. The range and the value of Sales[[#Totals],[Sales]] are read back from the engine after each call.

Powered by the real Formulon engine (WASM) — it runs entirely in your browser, nothing is uploaded.

Delete rows from a table ​

ws.deleteRows and ws.deleteCells follow Excel's table rules.

SpanResult
Holds the header row but not the whole tableThrows StatusCode.PreconditionFailed
Covers the whole tableRemoves the table
Covers every data rowKeeps the first data row, emptied
Covers the totals rowTurns the totals row off and clears every column's totals settings, so the next totalsRow: true fills in the defaults again
js
import createFormulon, { StatusCode } from '@libraz/formulon'

const formulon = await createFormulon()
const wb = formulon.Workbook.createDefault()
try {
  const ws = wb.sheet(0)
  ws.setValues('A1', [['Region', 'Sales'], ['East', 120], ['West', 90]])
  const table = ws.addTable({ range: 'A1:B3', name: 'Sales' })
  table.update({ totalsRow: true }) // the totals row is row 4

  try {
    ws.deleteRows(0, 1) // the header row and one data row
  } catch (e) {
    console.log(formulon.enumName(StatusCode, e.code)) // PreconditionFailed
  }

  ws.deleteRows(3, 3)
  console.log(table.getProperties().totalsRow) // false

  ws.deleteRows(1, 2)
  console.log(table.getProperties().range.rect.lastRow) // 1
  console.log(JSON.stringify(ws.getValues('A1:B2'))) // [["Region","Sales"],[null,null]]
} finally {
  wb.dispose()
}
python
import formulon
from formulon import FormulonError, StatusCode, TableInput, Workbook

with Workbook.create_default() as wb:
    ws = wb[0]
    ws["A1:B3"] = [["Region", "Sales"], ["East", 120], ["West", 90]]
    table = ws.add_table(TableInput(range="A1:B3", name="Sales"))
    table.update(totals_row=True)  # the totals row is row 4

    try:
        ws.delete_rows(0, 1)  # the header row and one data row
    except FormulonError as e:
        print(formulon.enum_name(StatusCode, e.code))  # PRECONDITION_FAILED

    ws.delete_rows(3, 3)
    print(table.get_properties().totals_row)  # False

    ws.delete_rows(1, 2)
    print(table.get_properties().range.rect.last_row)  # 1
    print(ws["A1:B2"])  # [['Region', 'Sales'], [None, None]]

List, find and remove tables ​

ws.listTables() lists the tables of one sheet, and wb.table(name) finds a table on any sheet, since a table name is unique in the workbook. ws.removeTable(ref) removes the table definition and keeps the cells. A formula that names the removed table keeps its structured reference and evaluates to #NAME?.

js
import createFormulon from '@libraz/formulon'

const formulon = await createFormulon()
const wb = formulon.Workbook.createDefault()
try {
  const ws = wb.sheet(0)
  ws.setValues('A1', [['Region', 'Sales'], ['East', 120], ['West', 90]])
  ws.addTable({ range: 'A1:B3', name: 'Sales', columns: ['Region', 'Sales'] })
  ws.setFormula('D1', '=SUM(Sales[Sales])')

  console.log(ws.listTables().map((t) => t.name).join()) // Sales
  console.log(wb.table('SALES').name) // Sales

  ws.removeTable('Sales')
  console.log(ws.listTables().length, ws.getValue('B2')) // 0 120
  console.log(String(ws.getValue('D1'))) // #NAME?
} finally {
  wb.dispose()
}
python
from formulon import TableInput, Workbook

with Workbook.create_default() as wb:
    ws = wb[0]
    ws["A1:B3"] = [["Region", "Sales"], ["East", 120], ["West", 90]]
    ws.add_table(TableInput(range="A1:B3", name="Sales", columns=["Region", "Sales"]))
    ws.set_formula("D1", "=SUM(Sales[Sales])")

    print(",".join(t.name for t in ws.list_tables()))  # Sales
    print(wb.table("SALES").name)  # Sales

    ws.remove_table("Sales")
    print(len(ws.list_tables()), ws["B2"])  # 0 120.0
    print(ws["D1"])  # #NAME?

After the removal, every use of the old Table handle throws StatusCode.NotFound. Tables and AutoFilter covers table styles, column renames and table AutoFilters.