How to Convert ODS to XLSX in Node.js

Cloudmersive
2 min readOct 18, 2023

--

While ODS files are compatible with Excel, saving ODS data in OpenXML format consolidates file size and offers several additional advantages.

Thankfully, we can easily convert our ODS files to XLSX format using a free API. We can structure our API call using the ready-to-run Node.js code examples below; on top of that, we’ll just need a free-tier API key (obtainable on the Cloudmersive website) to authorize our requests, and we’re all set.

We can install the SDK in one of two ways. We can either run this command:

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

Or add this snippet to our package.json:

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

After that, we can simply include the following code examples in our file, enter our API key, and begin converting ODS files with formdata:

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.ConvertDocumentApi();

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

And that’s all the code we’ll need!

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

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

No responses yet