excel_to_txt
Convert Excel files (XLS, XLSX) to plain text format for data extraction and processing. Use this tool to transform spreadsheet data into readable text documents.
Instructions
Convert Excel(XLS, XLSX) to TXT.
Ref: https://developer.pdf.co/api-reference/convert-from-excel/text.md
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL to the source file (XLS, XLSX). Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files. | |
| httpusername | No | HTTP auth user name if required to access source url. (Optional) | |
| httppassword | No | HTTP auth password if required to access source url. (Optional) | |
| name | No | File name for the generated output. (Optional) | |
| worksheetIndex | No | Index of the worksheet to convert. (Optional) | |
| api_key | No | PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional) |
Implementation Reference
- The handler function for the excel_to_txt tool. Decorated with @mcp.tool() for registration and schema definition via Pydantic Fields. Implements the tool by calling the convert_to helper with 'xls' to 'txt' parameters.@mcp.tool() async def excel_to_txt( url: str = Field( description="URL to the source file (XLS, XLSX). Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files." ), httpusername: str = Field( description="HTTP auth user name if required to access source url. (Optional)", default="", ), httppassword: str = Field( description="HTTP auth password if required to access source url. (Optional)", default="", ), name: str = Field( description="File name for the generated output. (Optional)", default="" ), worksheetIndex: str = Field( description="Index of the worksheet to convert. (Optional)", default="" ), api_key: str = Field( description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)", default="", ), ) -> BaseResponse: """ Convert Excel(XLS, XLSX) to TXT. Ref: https://developer.pdf.co/api-reference/convert-from-excel/text.md """ return await convert_to( "xls", "txt", ConversionParams( url=url, httpusername=httpusername, httppassword=httppassword, name=name, worksheetIndex=worksheetIndex, api_key=api_key, ), )
- pdfco/mcp/services/pdf.py:6-9 (helper)Supporting helper function that constructs the PDF.co API endpoint for generic format conversion and calls the request function to execute the HTTP POST request.async def convert_to( _from: str, _to: str, params: ConversionParams, api_key: str | None = None ) -> BaseResponse: return await request(f"{_from}/convert/to/{_to}", params, api_key=api_key)