assets_guardian.core.reporting.excel.reader

Functions

read_workbook([file_path,Β sheet_names])

Reads an existing Excel workbook in a highly optimized manner.

assets_guardian.core.reporting.excel.reader.read_workbook(file_path: str | Path | None = None, sheet_names: list[str] | None = None) dict[str, Any][source]

Reads an existing Excel workbook in a highly optimized manner.

This function utilizes openpyxl’s read_only mode to stream only target sheets (if provided), minimizing RAM and CPU usage.

Parameters:
  • file_path – Path to the Excel file. If None, resolves path from config.yml or fallback.

  • sheet_names – Optional list of sheets to load. If None, all sheets are loaded.

Raises:

FileNotFoundError – If the specified or resolved Excel file is not found.

Returns:

Workbook content structured as

{ sheet_name: {β€œheader”: …, β€œcontent”: …} }

Return type:

dict[str, Any]