Convert Excel Files to PDF in Python

Excel to PDF Python

Nowadays, PDF has become a standard file format for exchanging documents. Various popular document formats are converted to PDF before they are shared over the Internet. Excel to PDF is one of the popular conversion scenarios in which worksheets are converted to read-only PDF pages. In accordance with that, this article covers how to convert Excel XLSX or XLS files to PDF using Python.

Python Excel to PDF Converter API

For Excel to PDF conversion, we’ll use Aspose.Cells for Python via Java API. It is a powerful spreadsheet manipulation API that lets you create, process, and convert Excel files from within your Python applications. You can install the API using the following pip command.

  • pip install aspose-cells

Convert Excel XLSX to PDF using Python

The following are the steps to convert an Excel XLSX file to PDF using Python.

The following code sample shows how to convert an Excel XSLX file to PDF.

Excel File

Excel to PDF

Converted PDF

Converted PDF

Advanced XLSX/XLS to PDF Conversion in Python

Aspose.Cells for Python via Java also allows you to customize the XLSX to PDF conversion using different options. For example, you can set PDF compliance, compression, gridlines style, number of pages per sheet, etc. for the converted PDF file. The PdfSaveOptions class is used to set these options.

The following are the steps to use advanced options in XLSX to PDF conversion in Python.

The following code sample shows how to use advanced options in Excel XLSX to PDF conversion.

Get a Free API License

You can request a temporary license in order to use the API without evaluation limitations.

Conclusion

In this article, you have learned how to convert Excel XLSX or XLS to PDF using Python. Furthermore, the advanced options to control the Excel to PDF conversion are also discussed with the help of the code sample. You can explore more about Aspose.Cells for Python via Java using the documentation. In case you would have any queries, contact us via our forum.

See Also