all2md.parsers.xlsx
XLSX to AST converter.
This module provides conversion from Excel XLSX files to AST representation. It replaces the combined spreadsheet parser with a focused Excel parser.
- class all2md.parsers.xlsx.XlsxToAstConverter
Bases:
BaseParserConvert XLSX Excel files to AST representation.
This converter handles XLSX (Excel) format by building Table nodes from spreadsheet data.
- Parameters:
options (XlsxOptions or None) – Conversion options
Initialize the XLSX parser with options and progress callback.
- __init__(options: XlsxOptions | None = None, progress_callback: Callable[[ProgressEvent], None] | None = None)
Initialize the XLSX parser with options and progress callback.
- parse(input_data: str | Path | IO[bytes] | bytes) Document
Parse the XLSX file into an AST.
- Parameters:
input_data (str, Path, IO[bytes], or bytes) – The input Excel file to parse. Can be: - File path (str or Path) - File-like object in binary mode - Raw document bytes
- Returns:
AST Document node representing the parsed spreadsheet structure
- Return type:
- Raises:
ParsingError – If parsing fails due to invalid format or corruption
DependencyError – If required dependencies are not installed
ValidationError – If input data is invalid or inaccessible
- xlsx_to_ast(workbook: Any) Document
Convert an openpyxl workbook to AST Document.
- Parameters:
workbook (Any) – Openpyxl workbook
- Returns:
AST document with table nodes
- Return type:
- extract_metadata(document: Any) DocumentMetadata
Extract metadata from XLSX workbook.
- Parameters:
document (Any) – Excel workbook (openpyxl)
- Returns:
Extracted metadata
- Return type: