cadrumo.adapters.inbound.financial.providers.xlsx module¶
XLSX financial provider with header-row detection.
Implements XlsxProvider, an
FinancialProvider
backed by openpyxl. Reuses the bank-layout catalogue and scoring
helpers from adapters.inbound.financial.providers.csv so
the same alias rules apply to spreadsheet exports as to the
matching CSV downloads.
The selected worksheet emits
ParsedLedgerRow records
with the same magnitude/direction split as the CSV provider, while preserving
typed workbook cell values for dates and amounts until the parse boundary.
- class XlsxProvider[source]¶
Bases:
FinancialProviderIngest raw transactions from
.xlsxbank statement exports.Iterates every worksheet, scoring the first ten rows of each against
adapters.inbound.financial.providers.csv.CSV_LAYOUTSand selecting the worksheet/row pair with the highest match score. Numeric and date cell values are read directly from the cell types (rather than coerced through their printed strings) so locale-formattedDecimalanddateparsing stays accurate. Formula cells in selected data rows are refused rather than trusting a workbook’s potentially stale cached values.Like
CsvProvider, this provider shares the tabular alias catalogue and stores every parsed row as a raw transaction with explicit flow direction.- Variables:
_last_sheet_name – Name of the worksheet selected by the most recent
_locate_sheet()call; surfaced viaProviderValidation.detected_dialect._last_header_index – 1-based index of the header row in that worksheet.
- name: ClassVar[str]¶
- supported_extensions: ClassVar[frozenset[str]]¶
- source_format: ClassVar[SourceFormat]¶
- verification_source: ClassVar[CorpusVerificationSource]¶
- provisional_pending_specimen: ClassVar[bool]¶
- validate_source(path)[source]¶
Validate workbook accessibility and header detection.
- Return type:
- Returns:
A
ProviderValidationwith the validation outcome.- Parameters:
path (Path)
- ingest(path)[source]¶
Yield
ParsedLedgerRowrecords (magnitude + direction) from the first matching worksheet.- Return type:
- Parameters:
path (Path)