zut.excel.ExcelTable
- class zut.excel.ExcelTable(pyxl_table: Table | str, pyxl_worksheet: Worksheet, workbook: ExcelWorkbook, no_headers: bool = None)
Bases:
ColumnsProvider
- __init__(pyxl_table: Table | str, pyxl_worksheet: Worksheet, workbook: ExcelWorkbook, no_headers: bool = None)
Methods
__init__
(pyxl_table, pyxl_worksheet, workbook)add_column
(name)erase_cell
(row_index, col_index[, allow_outside])Erase the value of the cell located at the given 0-base indices, and apply the default formatting and formulas of the corresponding table column.
get_column_index
(name)get_row
(index, *[, readonly])Get row at the given 0-base index.
get_value
(row_index, col_index)insert_row
()is_column_empty
(col_index)is_row_empty
(row_index)iter_rows
([readonly])redefine
()set_value
(row_index, col_index, value)Set the value of the cell located at the given 0-base indices, and apply the default formatting and formulas of the corresponding table column.
truncate
()Attributes
Number of columns.
columns
headers
ref
0-base index of the first data row (excluding headers).
0-base index of the first column.
Number of data rows (excluding headers).
- property col_count: int
Number of columns.
- erase_cell(row_index: int, col_index: int, allow_outside: bool = False)
Erase the value of the cell located at the given 0-base indices, and apply the default formatting and formulas of the corresponding table column.
If allow_outside is set, the cell may be located outside of the table. In this case, no formatting or formula is applied.
- min_col_index: int
0-base index of the first column.
- min_row_index: int
0-base index of the first data row (excluding headers).
- row_count: int
Number of data rows (excluding headers).
- set_value(row_index: int, col_index: int, value: Any)
Set the value of the cell located at the given 0-base indices, and apply the default formatting and formulas of the corresponding table column.
Any value (including None) overrides default column formulas. If you want to use the default column formula, use erase_cell method instead.