How to get styles from an Excel XLSX spreadsheet or worksheet in Node.JS

Listen up all you Node.JS hotshots! Getting style information from Excel files just got a whole lot easier. Allow me to show you this little shortcut.

We start by adding Cloudmersive’s Node client to the list of dependencies in package.json:

"dependencies": {
"cloudmersive-convert-api-client": "^2.1.6"

Now it’s a matter of using our API key to set up an instance of our document editing API. We can then proceed to use this instance for calling editDocumentXlsxGetStyles.

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.EditDocumentApi();var input = new CloudmersiveConvertApiClient.GetXlsxStylesRequest(); // GetXlsxStylesRequest | Document input requestvar callback = function(error, data, response) {if (error) {console.error(error);} else {console.log('API called successfully. Returned data: ' + data);}};apiInstance.editDocumentXlsxGetStyles(input, callback);

That was a whole lot easier than trying to code it from the ground up, right? If you want to save even more time, you should read the documentation for the rest of this library. It can facilitate such actions as format conversion, screenshotting websites, and even removing HTML from text strings to prevent scripting attacks!

It feels pretty good when someone else does all the work for you!

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