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

Cloudmersive
2 min readMay 28, 2020

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!

--

--

Cloudmersive

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