How to convert Legacy XLS to CSV in Node.JS
1 min readApr 20, 2020
Today we are going to convert our deprecated XLS files into handy CSVs instead, generally making life easier. For Node.JS users, your usual option for accomplishing this would involve several hours of coding and possibly a nice fat headache. Instead of that, how about we wrap this up in under 5 minutes? Let’s dive in.
Npm install can be used to set up our client, requiring this command.
npm install cloudmersive-convert-api-client --save
Now call convertDocumentXlsToCsv, as you see below.
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.convertDocumentXlsToCsv(inputFile, callback);
Well look at that, we’re done. All that you needs do now is input your XLS files. Not too shabby.