Convert Excel to CSV format using REST API in Node.js

How to Convert Excel to CSV format using REST API in Node.js
How to Convert Excel to CSV format using REST API in Node.js

An Excel file stores data in tabular form in rows and columns while CSV file stores information in text format separated by commas. CSV files are faster and also consumes less memory while Excel files consume more memory while importing data. CSV file is simple plain text file that is easier to import into a spreadsheet or storage database. In certain cases, you may need to convert Excel file to CSV file. So, this article is about how to convert Excel to CSV format using REST API in Node.js.

The following topics shall be covered in this article:

Excel to CSV Conversion REST API and Node.js SDK

In order to convert Excel to CSV is using the Node.js SDK of GroupDocs.Conversion Cloud API. It is a platform-independent XLSX to CSV library and document conversion solution. It allows you to seamlessly convert your documents and images of any supported file format to any format you need. You can easily convert between over 50 types of documents and images such as Word, PowerPoint, Excel, PDF, HTML, CAD, raster images, etc. It also provides .NET, Java, PHP, Ruby, Android, and Python SDKs as its document conversion family members for the Cloud API.

You can install GroupDocs.Conversion Cloud to your Node.js project using the following command in the console:

npm install groupdocs-conversion-cloud

Please get your Client ID and Client Secret from the dashboard before you start following the steps and available code examples. Once you have your ID and secret, please add in the code as shown below:

How to Convert Excel to CSV file using REST API in Node.js

You can convert excel to csv in nodejs programmatically on the cloud by following the steps given below:

  1. Upload the excel file to the cloud
  2. Convert NodeJS XLSX to CSV file
  3. Download the converted CSV file

Upload the XLSX File

Firstly, upload the excel file to the cloud using the following code sample:

As a result, the uploaded Excel file will be available in the files section of your dashboard on the cloud.

Convert XLSX to CSV format in Node.js

You can convert xlsx to csv node programmatically by following the steps as given below:

  • Create an instance of the ConvertApi
  • Create an instance of the ConvertSettings
  • Set storage name and the input excel file path
  • Assign “csv” to the format
  • Now, provide the output csv file path
  • Create ConvertDocumentRequest with ConvertSettings
  • Convert by calling the convertDocument() method with ConvertDocumentRequest

The following code example shows how to convert Excel to CSV in Nodejs using REST API :

How to Convert Excel to CSV using REST API in Node.js
How to Convert Excel to CSV using REST API in Node.js

Download the Converted File

The above code sample will save the converted CSV file on the cloud. Now you know how to convert Excel to CSV in node. Next, download csv file using the following code sample:

Free Excel to CSV Converter Online

How to convert Excel to CSV online free? Please try the following to convert Excel to CSV online free, which is developed using the above API.

Conclusion

Excel and CSV files are widely used to store and transmit the data. In accordance with that, this article covered how to turn XLSX into CSV in Node.js applications. Now you know:

  • how to convert xlsx to csv using Node.js;
  • programmatically upload and download converted csv file;
  • free online excel to csv converter;

Furthermore, you can learn more about GroupDocs.Conversion Cloud API using the documentation. We also provide an API Reference section that lets you visualize and interact with our APIs directly through the browser.

Ask a question

You can ask your queries about how to convert XLSX into CSV format, via our Free Support Forum

See Also