Skip to content

Spec

excel_model.spec

Frozen dataclasses for model spec definitions.

DataSheetDef dataclass

Configuration for a tabular data sheet.

Source code in excel_model/spec.py
74
75
76
77
78
79
80
81
82
83
@dataclass(frozen=True)
class DataSheetDef:
    """Configuration for a tabular data sheet."""

    sheet_name: str
    title: str
    headers: tuple[str, ...]
    col_widths: tuple[float, ...]
    number_formats: Mapping[int, str]
    freeze_row: int

SumifsPivotDef dataclass

Configuration for a SUMIFS pivot sheet.

The value_col, row_filter_cols, and col_filter_col fields are Excel column letters (e.g. "AO", "AM") referring to columns on the data_sheet source worksheet:

  • value_col: column containing the numeric values to sum.
  • row_filter_cols: columns matched against each row's label values; len(row_filter_cols) must be <= len(row_label_headers).
  • col_filter_col: column matched against each col_dim_values header.
Source code in excel_model/spec.py
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
@dataclass(frozen=True)
class SumifsPivotDef:
    """Configuration for a SUMIFS pivot sheet.

    The ``value_col``, ``row_filter_cols``, and ``col_filter_col`` fields are
    Excel column letters (e.g. ``"AO"``, ``"AM"``) referring to columns on the
    ``data_sheet`` source worksheet:

    - ``value_col``: column containing the numeric values to sum.
    - ``row_filter_cols``: columns matched against each row's label values;
      len(row_filter_cols) must be <= len(row_label_headers).
    - ``col_filter_col``: column matched against each ``col_dim_values`` header.
    """

    sheet_name: str
    title: str
    row_label_headers: tuple[str, ...]
    col_dim_values: tuple[str | int | float, ...]
    data_sheet: str
    value_col: str
    row_filter_cols: tuple[str, ...]
    col_filter_col: str
    append_total: bool
    append_yoy: bool
    col_widths: tuple[float, ...]
    number_format_data: str
    number_format_pct: str
    freeze_row: int