Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/excel_mcp/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ def read_excel_range_with_metadata(
sheet_name: str,
start_cell: str = "A1",
end_cell: Optional[str] = None,
include_validation: bool = True
include_validation: bool = True,
data_only: bool = False
) -> Dict[str, Any]:
"""Read data from Excel range with cell metadata including validation rules.

Expand All @@ -182,12 +183,13 @@ def read_excel_range_with_metadata(
start_cell: Starting cell address
end_cell: Ending cell address (optional)
include_validation: Whether to include validation metadata

data_only: Whether to return data only

Returns:
Dictionary containing structured cell data with metadata
"""
try:
wb = load_workbook(filepath, read_only=False)
wb = load_workbook(filepath, read_only=False, data_only=data_only)

if sheet_name not in wb.sheetnames:
raise DataError(f"Sheet '{sheet_name}' not found")
Expand Down
7 changes: 4 additions & 3 deletions src/excel_mcp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def read_data_from_excel(
sheet_name: str,
start_cell: str = "A1",
end_cell: Optional[str] = None,
preview_only: bool = False
data_only: bool = False
) -> str:
"""
Read data from Excel worksheet with cell metadata including validation rules.
Expand All @@ -208,7 +208,7 @@ def read_data_from_excel(
sheet_name: Name of worksheet
start_cell: Starting cell (default A1)
end_cell: Ending cell (optional, auto-expands if not provided)
preview_only: Whether to return preview only
data_only: Whether to return data only

Returns:
JSON string containing structured cell data with validation metadata.
Expand All @@ -221,7 +221,8 @@ def read_data_from_excel(
full_path,
sheet_name,
start_cell,
end_cell
end_cell,
data_only=data_only
)
if not result or not result.get("cells"):
return "No data found in specified range"
Expand Down