How to Convert ODS to XLSX in Node.JS

Sometimes a simple document conversion can end up being a total slog through the coding mud. It’s at times like this that you need a nice shortcut to get you through. I have just such a one for you that will allow easy conversion between ODS and XLSX, and it will only require mere minutes of your time to get started. Let’s dive straight in.

We will use an API to get this done fast, so let’s add it as a dependency to our package.json file.

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

Now we can call our function with this bit of code here:

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

Easy! That’s all there is to it!

Image for post
Image for post

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