Skip to content

API Reference parrot.tools.dataset_manager.excel_analyzer

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.tools.dataset_manager.excel_analyzer

View source

Excel Structure Analysis Engine.

Scans complex Excel workbooks using openpyxl and discovers table structures via header-row heuristics. Produces SheetAnalysis and DetectedTable data models describing the structural layout.

Class CellRegion

A rectangular region within a sheet.

Parameter Type Default Description
start_row int
start_col int
end_row int
end_col int

Fields:

Field Type Default Description
start_row int
start_col int
end_row int
end_col int

Attributes:

Attribute Type Description
excel_range str Return the region as an Excel-style range string (e.g. 'A2:C5').
row_count int Number of rows in the region.
col_count int Number of columns in the region.

Class DetectedTable

A table discovered within a sheet.

Parameter Type Default Description
table_id str
title Optional[str]
header_row int
data_start_row int
data_end_row int
start_col int
end_col int
columns List[str]
row_count int
has_total_row bool False
section_label Optional[str] None

Fields:

Field Type Default Description
table_id str
title Optional[str]
header_row int
data_start_row int
data_end_row int
start_col int
end_col int
columns List[str]
row_count int
has_total_row bool False
section_label Optional[str] None

Attributes:

Attribute Type Description
excel_range str Return the full range of the table (header → last data row).

Method DetectedTable.to_summary

Return a human-readable summary of this table.

to_summary() -> str

Returns: str

Class ExcelStructureAnalyzer

Core analysis engine for Excel workbooks.

Uses openpyxl to scan sheets and discover table structures via header-row heuristics (3+ non-empty cells with 40 %+ strings and numeric data below).

Parameter Type Default Description
path Union[str, Path] Path to the Excel file.

Method ExcelStructureAnalyzer.analyze_workbook

Analyze all sheets and return a mapping of sheet name → SheetAnalysis.

analyze_workbook() -> Dict[str, SheetAnalysis]

Returns: Dict[str, SheetAnalysis]

Method ExcelStructureAnalyzer.extract_table_as_dataframe

Extract a detected table as a clean pandas DataFrame.

extract_table_as_dataframe(sheet_name: str, table: DetectedTable, include_totals: bool = True) -> pd.DataFrame

Parameter Type Default Description
sheet_name str Sheet containing the table.
table DetectedTable DetectedTable instance (from analyze_workbook).
include_totals bool True If False, exclude the total row (if detected).

Returns: pd.DataFrame — pandas DataFrame with proper column headers.

Method ExcelStructureAnalyzer.extract_cell_range

Read raw cell values from an arbitrary Excel-style range.

extract_cell_range(sheet_name: str, cell_range: str) -> List[List[Any]]

Parameter Type Default Description
sheet_name str Name of the sheet.
cell_range str Excel range string (e.g. 'A1:C5').

Returns: List[List[Any]] — List of rows, each a list of cell values.

Method ExcelStructureAnalyzer.close

Close all open workbooks.

close() -> None

Class SheetAnalysis

Complete structural analysis of one sheet.

Parameter Type Default Description
name str
total_rows int
total_cols int
tables List[DetectedTable] list()
merged_cells List[str] list()
standalone_labels List[Tuple[str, str]] list()

Fields:

Field Type Default Description
name str
total_rows int
total_cols int
tables List[DetectedTable] field(default_factory=list)
merged_cells List[str] field(default_factory=list)
standalone_labels List[Tuple[str, str]] field(default_factory=list)

Method SheetAnalysis.to_summary

Return a human-readable summary of this sheet's structure.

to_summary() -> str

Returns: str

Attribute TOTAL_KEYWORDS

Type: set[str]

Attribute logger

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally