How to convert Excel XLSX to PDF in Javascript

I’m going to guess that document format conversion is not high on your list of favorite subjects. That’s OK though, I don’t think anyone actually enjoys its many headaches, which is why today we are looking at an easy alternative method to accomplish the same results. We are going to use an API to do the job for us.

To gain access to our API, we need to add this script tag to our page or HTML file.

<script src=""></script>

So far, so good — now we are ready to invoke our API function for XLSX to PDF:

var CloudmersiveConvertApiClient = require('cloudmersive-convert-api-client');var defaultClient = CloudmersiveConvertApiClient.ApiClient.instance;// Configure API key authorization: Apikeyvar Apikey = defaultClient.authentications['Apikey'];Apikey.apiKey = 'YOUR API KEY';// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)//Apikey.apiKeyPrefix = 'Token';var apiInstance = new CloudmersiveConvertApiClient.ConvertDocumentApi();var inputFile = "/path/to/file"; // File | Input file to perform the operation on.var callback = function(error, data, response) {if (error) {console.error(error);} else {console.log('API called successfully. Returned data: ' + data);}};apiInstance.convertDocumentXlsxToPdf(inputFile, callback);

And with the simple block of code, we are already finished. Not a lot of work to do when you’ve got an API to do it for you, am I right?

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store