excel_to_xml
Convert Excel files (XLS, XLSX) to XML format using a secure and reliable process. Ideal for transforming spreadsheet data into structured XML, supporting public URLs and optional customizations like worksheet selection and file naming.
Instructions
Convert Excel(XLS, XLSX) to XML.
Ref: https://developer.pdf.co/api-reference/convert-from-excel/xml.md
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| api_key | No | PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional) | |
| httppassword | No | HTTP auth password if required to access source url. (Optional) | |
| httpusername | No | HTTP auth user name if required to access source url. (Optional) | |
| name | No | File name for the generated output. (Optional) | |
| 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. | |
| worksheetIndex | No | Index of the worksheet to convert. (Optional) |
Implementation Reference
- The core handler function for the 'excel_to_xml' MCP tool. Decorated with @mcp.tool() for automatic registration and schema definition via Pydantic Field descriptions. Executes the conversion using the shared convert_to service.@mcp.tool() async def excel_to_xml( 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 XML. Ref: https://developer.pdf.co/api-reference/convert-from-excel/xml.md """ return await convert_to( "xls", "xml", ConversionParams( url=url, httpusername=httpusername, httppassword=httppassword, name=name, worksheetIndex=worksheetIndex, api_key=api_key, ), )
- Input schema defined by function parameters using Pydantic Field with descriptions; output is BaseResponse.async def excel_to_xml( 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:
- pdfco/mcp/tools/apis/conversion.py:1086-1086 (registration)Registration of the tool via @mcp.tool() decorator on the handler function.@mcp.tool()