list_sheets
Retrieve all sheet names from a spreadsheet file to identify available worksheets for data processing or analysis.
Instructions
List all sheet names in a workbook, in workbook order.
Returns a list of sheet name strings. CSV files always return a single sheet named 'default'.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | Yes | Path to the spreadsheet file |
Implementation Reference
- The handler function for the 'list_sheets' tool, which uses 'load_workbook' to open the file and return its sheet names.
@mcp.tool() def list_sheets( file: Annotated[str, Field(description="Path to the spreadsheet file")], ) -> list[str]: """List all sheet names in a workbook, in workbook order. Returns a list of sheet name strings. CSV files always return a single sheet named 'default'. """ wb = load_workbook(file) return wb.sheetnames