Skip to main content

Convert Excel to PDF


Easily convert Excel documents to PDFs using The DynamicPDF API's pdf endpoint.

Convert Excel documents to PDFs using the pdf endpoint. Call the pdf endpoint directly or using one of our client libraries.

tip

Check out Getting Started and Task Roadmap if you are new to The DynamicPDF API.

Calling Endpoint Directly

Convert from a Excel document to a PDF using the excel element in a JSON instructions document.

The following example illustrates the steps in converting a simple word document to a PDF.

  • Create an instructions.json document that specifies excel as the input and the word document as the resourceName.
{
"inputs":[
{
"type":"excel",
"resourceName":"sample-data.xlsx"
}]
}
  • Add the authorization key as a header.
  • Add the Instructions document as a file and the Excel document as a file.
curl --location 'https://api.dpdf.io/v1.0/pdf'
--header 'Authorization: Bearer --api-key--
--form 'Instructions=@C:/temp/solutions/excel-pdf/instructions.json'
--form 'Resource=@C:/temp/solutions/excel-pdf/sample-data.xlsx'

Run In Postman

tip

See the Merge PDFs and Other Resources for more information on how you can merge multiple Word documents and other resources into a combined PDF.

Calling Endpoint Using Client Library

Easily convert Excel to a PDF using the ExcelInput class or its equivalent using the C#, Java, Node.js, PHP, Go, or Python. More details and examples are provided in the pdf Inputs documentation.

Client API Example Code

Here are examples illustrating both Word conversion to PDF and Excel conversion to PDF.

The following example illustrates creating a PDF from a Excel document.

Pdf pdf = new Pdf();
pdf.ApiKey = apiKey;
pdf.AddExcel(new ExcelResource(basePath + "/sample-data.xlsx"));
PdfResponse pdfResponse = pdf.Process();
Source: ExcelConversion.cs

Refer to our online documentation for more information on the excel input type.

info

The pdf endpoint takes a JSON instructions document that provides instructions for creating, transforming, merging, and formatting inputs into a combined PDF. Refer to documentation on the instructions schema for information on how to use the pdf endpoint.

   Follow us on social media for latest news!