Skip to main content
Conditional formatting reacts to content. Where cell styles fix appearance by position, these rules apply wherever the data meets a condition. Every rule takes the four range keys, and two optional keys that behave the same way across all four rule types.
int
required
The range the rule covers.
int
default:"1"
Decides which rule wins when ranges overlap. Lower numbers take precedence.
dict
How matching cells look, in the same shape as cell styles. When you omit it, Jetxl applies bold red text.
Color scales and data bars generate their own coloring, so style has no effect on them.

Highlight cells that meet a condition

"cell_value"
required
str
required
One of greater_than, less_than, equal, not_equal, greater_than_or_equal, less_than_or_equal, or between.
str
required
The threshold, written as a string. For between, give two numbers separated by a comma, such as "10,100".
Check the spelling of operator. An unrecognized value falls back to greater_than without raising an error, so greater_then produces a working file with the wrong rule in it.

Grade a range by color

"color_scale"
required
str
required
Color for the lowest value.
str
required
Color for the highest value.
str
Adding a midpoint turns a two-color ramp into a three-color one.
Two colors suit a simple low-to-high ramp. Three suit deviation from a middle, such as under target, on target, and over target.

Show magnitude with bars

"data_bar"
required
str
required
Bar fill color.
bool
default:"True"
Keeps the number visible next to the bar. Set it to False for bars alone.

Highlight the highest or lowest values

"top10"
required
The name comes from Excel’s dialog. The count isn’t fixed at ten.
int
required
How many cells to highlight.
bool
default:"False"
Set it to True to highlight the lowest values instead of the highest.

Layering rules

Rules are a list, and priority resolves overlaps. If you want negative numbers in red and every value carrying a bar, give the red rule the lower priority so it wins on the cells it covers.
An unrecognized rule_type doesn’t raise. Jetxl drops the rule and writes the rest of the file normally, so a typo gives you a spreadsheet with no conditional formatting and no indication why. Open the output and confirm the rule is there.