How to convert an Excel XLSX to a PNG Array in Node.JS

You should know upfront that the process by which an XLSX file is converted into a series of PNGs is a long and irritating one to set up. So, in answer to that, I am going to demonstrate for you a much easier way to get this done. That way we can spare you the pain and suffering that is normally required.

To make things super easy today, we are using an API, so download its client files now:

npm install cloudmersive-convert-api-client --save

Now for calling convertDocumentXlsxToPng, which will look like this:

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.convertDocumentXlsxToPng(inputFile, callback);

Input your file path, then sit back, relax, and wait for your PNG array to be returned to you. Easy mode!

Image for post

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