> ## Documentation Index
> Fetch the complete documentation index at: https://jetxl.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Type reference

> Every structure accepted by the formatting options

The shapes below are the `TypedDict` definitions from `jetxl.pyi`. Your editor completes them if you type-annotate.

## Colors

Give six or eight hex digits, with or without a leading `#`. Jetxl adds an opaque `FF` alpha to six-digit values. Chart text colors accept the same forms, but Jetxl drops the alpha from eight-digit values. Unusable values are omitted rather than raising an error. See [Conventions](/guides/conventions).

## Indexing

| Structure               | Rows    | Columns |
| ----------------------- | ------- | ------- |
| `CellStyleMap`          | 1-based | 0-based |
| `header_content`        | 1-based | 0-based |
| `ExcelTable` range      | 1-based | 0-based |
| `ExcelChart` data range | 1-based | 0-based |
| `ExcelChart` position   | 0-based | 0-based |
| `ExcelImage` position   | 0-based | 0-based |

## Styling

### FontStyle

<ResponseField name="bold" type="bool" />

<ResponseField name="italic" type="bool" />

<ResponseField name="underline" type="bool" />

<ResponseField name="size" type="float">Points.</ResponseField>
<ResponseField name="color" type="str">Hex color.</ResponseField>
<ResponseField name="name" type="str">Typeface.</ResponseField>

### FillStyle

<ResponseField name="pattern" type="&#x22;solid&#x22; | &#x22;gray125&#x22; | &#x22;none&#x22;" />

<ResponseField name="fg_color" type="str">Hex color.</ResponseField>
<ResponseField name="bg_color" type="str">Hex color.</ResponseField>

### BorderSide

<ResponseField name="style" type="&#x22;thin&#x22; | &#x22;medium&#x22; | &#x22;thick&#x22; | &#x22;double&#x22; | &#x22;dotted&#x22; | &#x22;dashed&#x22;" />

<ResponseField name="color" type="str">Hex color.</ResponseField>

### BorderStyle

<ResponseField name="left" type="BorderSide" />

<ResponseField name="right" type="BorderSide" />

<ResponseField name="top" type="BorderSide" />

<ResponseField name="bottom" type="BorderSide" />

### AlignmentStyle

<ResponseField name="horizontal" type="&#x22;left&#x22; | &#x22;center&#x22; | &#x22;right&#x22; | &#x22;justify&#x22;" />

<ResponseField name="vertical" type="&#x22;top&#x22; | &#x22;center&#x22; | &#x22;bottom&#x22;" />

<ResponseField name="wrap_text" type="bool" />

<ResponseField name="text_rotation" type="int">0 to 180 degrees, or `255` for vertical.</ResponseField>

### CellStyle

<ResponseField name="font" type="FontStyle" />

<ResponseField name="fill" type="FillStyle" />

<ResponseField name="border" type="BorderStyle" />

<ResponseField name="alignment" type="AlignmentStyle" />

<ResponseField name="number_format" type="NumberFormat" />

### CellStyleMap

`CellStyle` plus a position. This is what `cell_styles` takes.

<ResponseField name="row" type="int">1-based.</ResponseField>
<ResponseField name="col" type="int">0-based.</ResponseField>

<Note>
  The stub annotates `cell_styles` as `List[CellStyleMap]` on `write_sheet_arrow` but as `List[CellStyleDict]` on `write_sheet_arrow_to_bytes`, and `CellStyleDict` has no definition in the file. The runtime behavior is the same; only the annotation differs.
</Note>

## Validation

All three share `start_row`, `start_col`, `end_row`, `end_col`, `show_dropdown`, `error_title` and `error_message`.

<ResponseField name="DataValidationList" type="TypedDict">
  <Expandable title="fields">
    <ResponseField name="type" type="&#x22;list&#x22;" />

    <ResponseField name="items" type="list[str]" />
  </Expandable>
</ResponseField>

<ResponseField name="DataValidationNumber" type="TypedDict">
  <Expandable title="fields">
    <ResponseField name="type" type="&#x22;whole_number&#x22; | &#x22;decimal&#x22;" />

    <ResponseField name="min" type="float" />

    <ResponseField name="max" type="float" />
  </Expandable>
</ResponseField>

<ResponseField name="DataValidationTextLength" type="TypedDict">
  <Expandable title="fields">
    <ResponseField name="type" type="&#x22;text_length&#x22;" />

    <ResponseField name="min" type="int" />

    <ResponseField name="max" type="int" />
  </Expandable>
</ResponseField>

## Conditional formatting

All four share the four range keys, plus an optional `priority` (default `1`) and an optional `style`. Omitting `style` gives bold red text. Color scales and data bars ignore `style`.

<Warning>
  An unrecognized `rule_type` causes the rule to be dropped silently rather than raising.
</Warning>

<ResponseField name="ConditionalFormatCellValue" type="TypedDict">
  <Expandable title="fields">
    <ResponseField name="rule_type" type="&#x22;cell_value&#x22;" />

    <ResponseField name="operator" type="str">
      `greater_than`, `less_than`, `equal`, `not_equal`, `greater_than_or_equal`, `less_than_or_equal`, `between`. An unrecognized value silently becomes `greater_than`.
    </ResponseField>

    <ResponseField name="value" type="str">Threshold. Comma-separated pair for `between`.</ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="ConditionalFormatColorScale" type="TypedDict">
  <Expandable title="fields">
    <ResponseField name="rule_type" type="&#x22;color_scale&#x22;" />

    <ResponseField name="min_color" type="str" />

    <ResponseField name="max_color" type="str" />

    <ResponseField name="mid_color" type="str">Optional third stop.</ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="ConditionalFormatDataBar" type="TypedDict">
  <Expandable title="fields">
    <ResponseField name="rule_type" type="&#x22;data_bar&#x22;" />

    <ResponseField name="color" type="str" />

    <ResponseField name="show_value" type="bool">Default `True`.</ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="ConditionalFormatTop10" type="TypedDict">
  <Expandable title="fields">
    <ResponseField name="rule_type" type="&#x22;top10&#x22;" />

    <ResponseField name="rank" type="int" />

    <ResponseField name="bottom" type="bool">Default `False`. `True` selects the bottom N.</ResponseField>
  </Expandable>
</ResponseField>

## ExcelTable

<ResponseField name="name" type="str" required />

<ResponseField name="start_row" type="int" required>1-based.</ResponseField>
<ResponseField name="start_col" type="int" required>0-based.</ResponseField>
<ResponseField name="end_row" type="int">Optional. Omit it or pass `0` to size from the data.</ResponseField>
<ResponseField name="end_col" type="int">Optional. Omit it or pass `0` to size from the data.</ResponseField>

<ResponseField name="display_name" type="str" />

<ResponseField name="style" type="str" />

<ResponseField name="show_first_column" type="bool" />

<ResponseField name="show_last_column" type="bool" />

<ResponseField name="show_row_stripes" type="bool">Default `True`.</ResponseField>

<ResponseField name="show_column_stripes" type="bool" />

<ResponseField name="show_header_row" type="bool">Default `True`.</ResponseField>
<ResponseField name="show_totals_row" type="bool">Default `False`.</ResponseField>

<ResponseField name="column_names" type="list[str]" />

## ExcelChart

<ResponseField name="chart_type" type="&#x22;column&#x22; | &#x22;bar&#x22; | &#x22;line&#x22; | &#x22;pie&#x22; | &#x22;scatter&#x22; | &#x22;area&#x22;" required />

<ResponseField name="data_range" type="tuple[int, int, int, int]">Alternative to the four range keys.</ResponseField>
<ResponseField name="start_row / start_col / end_row / end_col" type="int">Data range.</ResponseField>
<ResponseField name="from_col / from_row / to_col / to_row" type="int">Chart position.</ResponseField>

<ResponseField name="title" type="str" />

<ResponseField name="category_col" type="int">0-based x-axis column.</ResponseField>

<ResponseField name="series_names" type="list[str]" />

<ResponseField name="show_legend" type="bool" />

<ResponseField name="legend_position" type="&#x22;right&#x22; | &#x22;left&#x22; | &#x22;top&#x22; | &#x22;bottom&#x22; | &#x22;none&#x22;" />

<ResponseField name="x_axis_title" type="str" />

<ResponseField name="y_axis_title" type="str" />

<ResponseField name="stacked" type="bool" />

<ResponseField name="percent_stacked" type="bool">Values run 0.0 to 1.0.</ResponseField>

<ResponseField name="show_data_labels" type="bool" />

<ResponseField name="chart_style" type="int">1 to 48 legacy, 101 to 148 modern with a `value - 100` fallback.</ResponseField>

<ResponseField name="axis_min" type="float" />

<ResponseField name="axis_max" type="float" />

<ResponseField name="title_bold / axis_title_bold / legend_bold" type="bool" />

<ResponseField name="title_font_size / axis_title_font_size / legend_font_size" type="int">Hundredths of a point.</ResponseField>
<ResponseField name="title_color / axis_title_color" type="str">Hex color. Eight-digit values have the alpha dropped.</ResponseField>

## ExcelImage

Either shape is accepted.

<ResponseField name="ExcelImageFromPath" type="TypedDict">
  <Expandable title="fields">
    <ResponseField name="path" type="str" required />

    <ResponseField name="from_col / from_row / to_col / to_row" type="int" required>0-based.</ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="ExcelImageFromBytes" type="TypedDict">
  <Expandable title="fields">
    <ResponseField name="data" type="bytes" required />

    <ResponseField name="extension" type="str" required>`"png"`, `"jpg"`, and so on.</ResponseField>
    <ResponseField name="from_col / from_row / to_col / to_row" type="int" required>0-based.</ResponseField>
  </Expandable>
</ResponseField>

## NumberFormat

Sixteen built-in names, or any Excel format code as a string. See [Number formats](/guides/number-formats).
