sheetwise.workbook module

Multi-sheet workbook handling and cross-sheet reference management.

class sheetwise.workbook.WorkbookManager[source]

Bases: object

Manages multi-sheet workbooks and cross-sheet references.

This class provides utilities to: 1. Load and process entire Excel workbooks with multiple sheets 2. Handle cross-sheet references and relationships 3. Compress entire workbooks 4. Identify inter-sheet relationships

__init__()[source]

Initialize the workbook manager.

load_workbook(excel_path)[source]

Load all sheets from an Excel workbook.

Parameters:

excel_path (str) – Path to the Excel file

Return type:

Dict[str, DataFrame]

Returns:

Dictionary mapping sheet names to dataframes

detect_cross_sheet_references()[source]

Detect references between sheets using formula analysis.

Return type:

Dict[str, Set[str]]

Returns:

Dictionary mapping sheet names to sets of referenced sheets

get_sheet_relationship_graph()[source]

Generate a directed graph of sheet relationships.

Return type:

Dict[str, Any]

Returns:

Dictionary with graph representation of sheet relationships

compress_workbook(compressor)[source]

Compress all sheets in the workbook.

Parameters:

compressor – SheetCompressor instance to use for compression

Return type:

Dict[str, Any]

Returns:

Dictionary with compression results for each sheet

encode_workbook_for_llm(compression_results)[source]

Generate LLM-ready encoding of the entire workbook.

Parameters:

compression_results (Dict[str, Any]) – Output from compress_workbook

Return type:

str

Returns:

LLM-ready text representation of the workbook

get_sheet_importance_ranking()[source]

Rank sheets by their importance in the workbook.

Return type:

List[Tuple[str, float]]

Returns:

List of (sheet_name, importance_score) tuples, sorted by importance