Colors
Give a color as a hex string. Jetxl accepts several spellings and normalizes them for you.
You don’t need to memorize alpha. Paste the six-digit hex from your design tool and Jetxl makes it opaque.
Chart text colors take the same forms. If you give eight digits, Jetxl discards the alpha, because the chart format Excel uses accepts only six.
Rows and columns
Indexing isn’t uniform, and this causes more mistakes than anything else in the API.
Cell B2 in
cell_styles is {"row": 2, "col": 1}. The row matches what Excel shows you; the column counts from zero, like a Python list.
Errors
Jetxl fails in three different ways depending on what’s wrong. Errors raised from the Rust core arrive asOSError, not ValueError, so catch OSError when you need to handle them.
Raises immediately
Raises immediately
A number format code that’s empty or all letters, such as
"accounting", raises an OSError naming the bad code. So does an unsupported column type, and exceeding Excel’s grid limits.Falls back silently
Falls back silently
An unrecognized comparison
operator becomes greater_than instead of raising. Check your spelling, because greater_then produces a working file with the wrong rule.Drops the setting
Drops the setting
An unusable color is omitted. So is a conditional format with an unrecognized
rule_type, and a table missing a required key such as name. The rest of the file writes normally, with no warning that the feature didn’t apply.Naming
Functions ending in_arrow read Arrow memory. Functions ending in _to_bytes return the workbook instead of writing a file. Plural names, such as write_sheets_arrow, take a list of sheets.