Learn how to convert Excel to PDF online using Python SDK. Save XLS to PDF.

Convert Excel to PDF

Convert Excel to PDF | XLS to PDF conversion API

In this article, we are going to discuss the details on how to convert Excel to PDF using Python SDK. We use Excel spreadsheets to store, organize, and track data sets. It is used by accountants, data analysts, and other professionals. But in order to view these files, we need a specific application such as MS Excel, OpenOffice Calc, etc. However, if we save Excel to PDF, it can be viewed on any platform and any device.

Excel to PDF Conversion API

Aspose.Cells Cloud is REST API offering the capabilities to create, edit and transform excel files to PDF and other supported formats. In order to use these features in the Python application, please try using Aspose.Cells Cloud SDK for Python. Please use the following command in the console to install the SDK:

pip install asposecellscloud

The next step is to create an Aspose Cloud account and obtain client credential details. These credentials are necessary to connect to Cloud services as well as to access documents from cloud storage.

Convert Excel to PDF in Python

Please follow the steps given below to convert Excel to PDF format using a Python code snippet.

Excel to PDF

Image 1:- Excel to PDF conversion preview.

The sample files used in the above example can be downloaded from Book1.xlsx and Converted.pdf.

XLS to PDF using cURL Commands

The REST APIs can easily be accessed via cURL commands on any platform. Since Aspose.Cells Cloud is developed on REST architecture, so we can also perform XLS to PDF conversion using cURL commands. So first we need to generate a JWT access token based on client credentials. Please execute the following command:

curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=bbf94a2c-6d7e-4020-b4d2-b9809741374e&client_secret=1c9379bb7d701c26cc87e741a29987bb" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

Now we need to execute the following command to convert xls to pdf online.

curl -v -X GET "https://api.aspose.cloud/v3.0/cells/Book1.xlsx?format=PDF&isAutoFit=true&onlySaveTable=false&outPath=Converted.pdf&checkExcelRestriction=true" \
-H  "accept: application/json" \
-H  "authorization: Bearer <JWT Token>" \
-d{}

Conclusion

In this blog, we have discussed the steps to Convert Excel to PDF using Python code snippets. At the same time, we have explored the options to save Excel to PDF using cURL commands. The complete source code of Python SDK can be downloaded from GitHub. We also recommend you explore Programmers Guide to learn more about other exciting features.

Should you have any related query or you encounter any issue while using our APIs, please feel free to contact us via Free Technical Support forum.

It is highly recommended to visit the following links to learn more about