Command-Line Interface
ExcelTableKit ships with a small CLI so you can apply a standard table style
to an .xlsx file without writing any Python. The entry point is
exceltablekit.
exceltablekit [OPTIONS] COMMAND [ARGS]...
Available commands
info
Prints the installed versions of ExcelTableKit and its dependencies.
exceltablekit info
Example output:
exceltablekit version: 2.0.1
openpyxl version: 3.1.5
tabulate version: 0.9.0
click version: 8.1.8
Use this command to confirm a successful installation or to record the dependency versions for a bug report.
style
Creates (or opens) an .xlsx file, defines a table range, and applies a
background colour, header colour, and border style.
exceltablekit style FILEPATH [OPTIONS]
Arguments
Argument |
Description |
|---|---|
|
Path to the |
Options
Option |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Top-left cell of the table range (e.g. |
|
|
|
Bottom-right cell of the table range (e.g. |
|
|
|
Number of header rows at the top of the range. |
|
|
|
Background fill colour for body cells (6-character hex, no |
|
|
|
Background fill colour for header cells (6-character hex, no |
|
|
|
Border style applied to all cells. Must be one of the 13 valid
|
Note
All hex colour values are supplied without the leading # character.
Border style choices
The --border-style option accepts any of the following values:
dashDot, dashDotDot, dashed, dotted, double,
hair, medium, mediumDashDot, mediumDashDotDot,
mediumDashed, slantDashDot, thick, thin
Examples
Create a styled table using all defaults:
exceltablekit style report.xlsx
Create a table from A1 to F50 with 2 header rows:
exceltablekit style report.xlsx \
--start A1 \
--end F50 \
--header-rows 2
Apply a custom colour scheme and a thicker border:
exceltablekit style report.xlsx \
--start B2 \
--end G30 \
--header-bg 2E75B6 \
--bg F2F2F2 \
--border-style medium
Style a table in an existing file, creating the file if needed:
exceltablekit style /path/to/output/sales_q2.xlsx \
--start A1 \
--end D100 \
--header-rows 1 \
--header-bg 375623 \
--bg E2EFDA
What the style command does
Behind the scenes, exceltablekit style performs these steps in order:
ExcelManager(filepath)— opens or creates the file.excel.set_table(start, end)— defines the cell range.excel.define_header(rows)— marks the header rows.ExcelStyle.set_background(bg)— fills body cells.ExcelStyle.set_border(border_style)— applies borders to body cells.ExcelStyle.set_header_background(header_bg)— fills header cells.ExcelStyle.set_header_font(bold=True, hex_color="FFFFFF")— white bold text for the header.ExcelStyle.set_header_border(border_style)— applies borders to header cells.ExcelStyle.auto_fit_columns()— adjusts column widths to fit content.