assets_guardian.core.reporting.excel.readerο
Functions
|
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]