list_workbooks
Scan a directory to find and list spreadsheet files (XLSX, CSV, ODS) with their full paths in alphabetical order.
Instructions
List all spreadsheet files (.xlsx, .csv, .ods) in a directory (non-recursive).
Returns the full path of each file found, sorted alphabetically.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| directory | Yes | Absolute or relative path to the directory to scan |
Implementation Reference
- Implementation of the list_workbooks tool which scans a directory for supported spreadsheet files.
def list_workbooks( directory: Annotated[str, Field(description="Absolute or relative path to the directory to scan")], ) -> list[str]: """List all spreadsheet files (.xlsx, .csv, .ods) in a directory (non-recursive). Returns the full path of each file found, sorted alphabetically. """ d = Path(directory) if not d.is_dir(): raise ValueError(f"Not a directory: {directory}") return sorted( str(f) for f in d.iterdir() if f.suffix.lower() in SUPPORTED_EXTENSIONS and f.is_file() )