read_excel
Extract data from Excel files by reading content and converting it into structured JSON format for analysis or integration.
Instructions
Read content from Excel (xlsx) files
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | Path to the Excel file |
Implementation Reference
- Core handler logic for the 'read_excel' tool: iterates over all sheets in the workbook, reads each row, converts cell values to strings, and stores in a dictionary by sheet name.if name == "read_excel": # Original functionality - process all sheets for sheet_name in workbook.sheetnames: sheet = workbook[sheet_name] sheet_data = [] for row in sheet.rows: row_data = [str(cell.value) if cell.value is not None else "" for cell in row] sheet_data.append(row_data) result[sheet_name] = sheet_data
- src/excel_reader_server/server.py:20-32 (registration)Registers the 'read_excel' tool via the list_tools() handler, including its JSON schema for input validation (requires 'file_path') and description.name="read_excel", description="Read content from Excel (xlsx) files", inputSchema={ "type": "object", "properties": { "file_path": { "type": "string", "description": "Path to the Excel file" } }, "required": ["file_path"] } ),
- JSON Schema definition for the 'read_excel' tool inputs."type": "object", "properties": { "file_path": { "type": "string", "description": "Path to the Excel file" } }, "required": ["file_path"] }