aeat.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: FinancialProvider

Ingest raw transactions from .xlsx bank statement exports.

Iterates every worksheet, scoring the first ten rows of each against adapters.inbound.financial.providers._csv.CSV_LAYOUTS and 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-formatted Decimal and date parsing stays accurate.

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 via ProviderValidation.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:

ProviderValidation

Returns:

A ProviderValidation with the validation outcome.

Parameters:

path (Path)

ingest(path)[source]

Yield ParsedLedgerRow records (magnitude + direction) from the first matching worksheet.

Return type:

Iterator[ParsedLedgerRow]

Parameters:

path (Path)