excel_to_pdf
Convert Excel files (XLS, XLSX) to PDF using a direct URL or built-in storage. Ideal for processing spreadsheets into shareable documents with optional worksheet selection.
Instructions
Convert Excel(XLS, XLSX) to PDF.
Ref: https://developer.pdf.co/api-reference/convert-from-excel/pdf.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 handler function for the 'excel_to_pdf' tool, including registration via @mcp.tool() decorator and input schema via Pydantic Fields. It invokes the convert_to helper to perform XLS/XLSX to PDF conversion using PDF.co API.@mcp.tool() async def excel_to_pdf( 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 PDF. Ref: https://developer.pdf.co/api-reference/convert-from-excel/pdf.md """ return await convert_to( "xls", "pdf", ConversionParams( url=url, httpusername=httpusername, httppassword=httppassword, name=name, worksheetIndex=worksheetIndex, api_key=api_key, ), )
- pdfco/mcp/tools/apis/conversion.py:1128-1128 (registration)The @mcp.tool() decorator registers the excel_to_pdf function as an MCP tool.@mcp.tool()
- Input schema defined by Pydantic Field annotations on the function parameters, including descriptions and defaults.async def excel_to_pdf( 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: