The XLSB is a collection of records and structures that specify Excel workbook content. Usually, the content includes unstructured or semi-structured tables of numbers, text, or both numbers and text, formulas, external data connections, charts, and images. In order to have wider adaptability and data sharing across the teams, the conversion to PDF format is a practical approach. Therefore, in this article, we are going to discuss the details on how to convert XLSB to PDF using Python SDK.
- Excel conversion API
- XLSB to PDF in Python
- Convert Excel to PDF using cURL Commands
- Convert Specific Excel Sheet to PDF using Python
Excel Conversion API
Aspose.Cells Cloud SDK For Python is our proven solution for excel file creation, manipulation, and transformation to major file formats including PDF. So let’s install the SDK by executing the following command:
pip install asposecellscloud
After installation, the next step is to register a free account over Aspose.Cloud dashboard using GitHub or Google account or use Sign Up to obtain your Client Credentials.
XLSB to PDF in Python
In this section, we are going to follow the steps to load XLSB (excel) worksheet from cloud storage and transform it into PDF format. Please note that we are going to convert the complete workbook to PDF format.
- Firstly, create an object of CellsApi using client credentials
- Secondly, specify the name of input XLSB, resultant file name, and output format as PDF
- Call cells_workbook_get_workbook(…) method to convert XLSB to PDF and save the output to Cloud storage
Convert Excel to PDF using cURL Commands
Now we are going to follow the steps to save excel to pdf using cURL Commands in a command-line terminal. So first we need to generate a JWT access token (based on our client credentials)
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 execute the following command to convert Excel to PDF format. After the execution, the resultant PDF is saved to the same cloud storage.
curl -v -X GET "https://api.aspose.cloud/v3.0/cells/myDocument.xlsb?format=PDF&isAutoFit=false&onlySaveTable=false&outPath=Converted.pdf&checkExcelRestriction=true" \ -H "accept: application/json" \ -H "authorization: Bearer <JWT Token>"
Convert Specific Excel Sheet to PDF using cURL Command
We may have a requirement to convert the selected worksheet of XLS to PDF format, rather than transforming the complete workbook. So in this section, we are going to accomplish this requirement.t credentials.
curl -v -X GET "https://api.aspose.cloud/v3.0/cells/myDocument.xlsb/worksheets/Sheet2?format=PDF&verticalResolution=0&horizontalResolution=0" \ -H "accept: application/json" \ -H "authorization: Bearer <JWT Token>" \ -o SingleWorksheet.pdf
Get the sample files used in the above examples from the following links
We have learned the steps to convert Excel to PDF (XLSB to PDF) using Python SDK. At the same time, we have learned the details on how to convert complete Excel to PDF using cURL commands, as well as how to export specific Excel sheet to PDF. You may consider exploring the Developer Guide to learn about other exciting features being offered by the API. In case you encounter any issues, please feel free to contact us via the free technical support forum.
We recommend going through the following articles for further understanding: