TableColumn

class TableColumn

A column in an Excel table. Obtain it again after changing table structure.

Examples

import xlwings as xw

table = xw.Book().sheets[0].tables["Table1"]
column = table.columns["MyColumn"]
print(column.index)
print(column.data_body_range.value)
column.delete()
property data_body_range: Range | None

Data cells, excluding header and totals. In xlwings Lite, use await get_data_body_range().

delete()

Delete the column from its table. Excel may move cells beside the table.

async get_data_body_range()

Fetch this column’s current data cells in xlwings Lite.

Return type:

Range | None

async get_range()

Fetch this column’s current range in xlwings Lite.

Return type:

Range

property index: int

One-based position within the table.

property name: str

The column header.

property range: Range

All cells in this column. In xlwings Lite, use await get_range().