Excel to PDF

Convert Excel to PDF using Node.js

Excel is one of the popular file formats for computation data storage. It is capable of storing data like numbers and formulas, text, and drawing shapes. Furthermore, Excel is part of the Microsoft Office Suite of software, so many users use it to produce the XLS files. Furthermore, owing to its capabilities for storing data in a grid of cells arranged in numbered rows and letter-named columns to organize data manipulations like arithmetic operations, it has become very popular. But in order to view these files, you need to have a specific application installed. Also, various versions of software display the files in different formattings. Therefore, in order to resolve all these issues, the conversion of the file to PDF format is a viable solution because the majority of web browsers on desktops and various free applications on mobile devices conveniently display PDF documents.

In this article, we are going to discuss the conversion of Excel to PDF conversion using Cloud REST API.

Excel to PDF Conversion API

Aspose.Cells Cloud is our award-winning REST API offering the capabilities to create excel files from scratch, edit the content in the existing files and, render the file to formats such as XLSM, HTML, XPS, TIFF, SVG, and much more. So as per the scope of this article, we are going to use Aspose.Cells Cloud SDK for Node.js.

Convert Excel to PDF using cURL Commands

In this section, we are going to use the cURL Commands to save Excel to PDF format. So the first step is to create a Free account subscription on Aspose.Cloud dashboard. If you have GitHub or Google account, simply Sign Up. Otherwise, click on the Create a new Account button and provide the required information. Login to the dashboard to access your Client Credentials.

Now please execute the following command to generate the JWT access token.

curl -v "https://api.aspose.cloud/connect/token" \
-d "grant_type=client_credentials&client_id=718e4235-8866-4ebe-bff4-f5a14a4b6466&client_secret=388e864b819d8b067a8b1cb625a2ea8e" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

Once we have the JWT token, we need to execute the following cURL command to upload a file from the local system to Cloud storage and then perform the conversion to PDF format.

curl -X PUT "https://api.aspose.cloud/v3.0/cells/storage/file/conditional.xls" \
-H  "accept: application/json" 
-H  "authorization: Bearer <JWT Token>" \
-H  "Content-Type: multipart/form-data" \
-d {"File":{}}

In case you need to perform the conversion of an XLS file already available in Cloud storage to PDF format, please try using the following cURL command:

curl -X GET "https://api.aspose.cloud/v3.0/cells/conditional.xls?format=PDF&isAutoFit=true&onlySaveTable=false&outPath=output.pdf" \
-H  "accept: application/json" \
-H  "authorization: Bearer <JWT Token>"

Convert XLS to PDF in Node.js

In this section, we are going to discuss the steps and details on how to perform the Excel worksheet conversion to PDF format using Node.js SDK. The first step is to install the SDK on the local system which is available for download at NPM and GitHub. So we are going to run the following command to install the SDK from NPM

npm i asposecellscloud

After the installation, we can execute the following code snippet to perform XLS to PDF conversion using Node.js

  • Create objects defining Client ID and Client Secret details
  • Then create an object of CellsApi class that takes Client ID and Client Secret details as arguments
  • The next step is to read the contents of the input XLS file available on the local system using the createReadStream(…) method of the File System Module
  • Now create an instance of UploadFileRequest class and then pass input Stream data to the file property
  • In order to upload the file to cloud storage, please call uploadFile(…) method of CellsApi
  • The next step is to create an object of CellsSaveAs_PostDocumentSaveAsRequest(…) class
  • Furthermore, create an instance of PdfSaveOptions class and pass the value of PDF to saveFormat property
  • Finally, call the cellsSaveAsPostDocumentSaveAs(..) method of CellsApi class to initiate the conversion process


In this article, we have discussed the details regarding the conversion of Excel to PDF format in a simple and convenient manner. Please note that Aspose.Cells Cloud SDK for Node.js is developed according to open-source principles, so the complete source code is available for download at GitHub. In case you encounter any issue while using the API or you have any related queries, please do not hesitate to ask via the Free product support forum.

You may consider visiting the following links to learn more about