read_excel
Extract data from Excel (xlsx) files into structured JSON format with a specified file path. Ideal for accessing workbook or sheet content programmatically.
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
- src/excel_reader_server/server.py:19-32 (registration)Registration of the 'read_excel' tool in the list_tools() handler, defining its name, description, and input schema.types.Tool( 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 for input validation of the 'read_excel' tool, requiring 'file_path'.inputSchema={ "type": "object", "properties": { "file_path": { "type": "string", "description": "Path to the Excel file" } }, "required": ["file_path"] }
- Core handler logic for executing the 'read_excel' tool: loads the workbook, iterates over all sheets, reads rows and cells into a nested list structure, and stores in a result 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