How to convert Legacy XLS 97–03 Spreadsheet to Excel XLSX in Node.JS
Out of date formats, like the old XLS, can be truly irritating to deal with. It’s generally best to update them to the newer XLSX format as quickly as possible to avoid further headache. Even this conversion process can be annoying in its own right, that is unless you have access to one of our APIs to work it out for you. Let’s try out that last option.
First off, npm install will be handling the setup of the API client with this command.
npm install cloudmersive-convert-api-client --save
And once that has completed, it will be time to call our function with this block 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.convertDocumentXlsToXlsx(inputFile, callback);
Now any outdated XLS file that you input will be returned in XLSX form. Easy!