How to Convert XLSX to XML in Node.JS

When working with raw data in spreadsheet format, Excel is one of the simplest and most user-friendly options. However, if you need to move your spreadsheet to another program, you may need to convert your XLSX file to XML. The following API will allow you to perform that action instantly, and the only necessary input is your XLSX file.

Image for post
Image for post

To use this API, run this command to install the SDK:

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

You may also add this snippet to your package.json:

"dependencies": {
"cloudmersive-convert-api-client": "^2.4.8"
}

Then, you can call the function:

var CloudmersiveConvertApiClient = require('cloudmersive-convert-api-client');
var defaultClient = CloudmersiveConvertApiClient.ApiClient.instance;
// Configure API key authorization: Apikey
var Apikey = defaultClient.authentications['Apikey'];
Apikey.apiKey = 'YOUR API KEY';
var apiInstance = new CloudmersiveConvertApiClient.ConvertDataApi();var inputFile = Buffer.from(fs.readFileSync("C:\\temp\\inputfile").buffer); // 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.convertDataXlsxToXml(inputFile, callback);

With that, you can retrieve and utilize your spreadsheets on any platform necessary for your next project.

You can retrieve the API Key from Cloudmersive at no cost and with no commitment. This will give you access to 800 monthly calls across our library of 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