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 document organizes data in a tabular structure using rows and columns, whereas a CSV file represents data in a plain text format with values separated by commas. CSV files offer quicker processing and consume less memory compared to Excel files when importing data. This simplicity makes CSV files easier to import into spreadsheets or storage databases. In specific scenarios, you might find it necessary to convert an Excel file into a CSV format. Consequently, this article will guide you on converting Excel files to CSV format using a REST API in Node.js.

The following topics shall be covered in this article:

Excel to CSV Conversion REST API and Node.js SDK

To transform Excel files into CSV format, you can utilize the GroupDocs.Conversion Cloud’s Node.js SDK API. This API is a versatile tool designed for platform-independent XLSX to CSV conversion and offers comprehensive document conversion capabilities. With this API, you can effortlessly convert documents and images of various file formats into your desired output format. It supports conversion between more than 50 different types of documents and images, including Word, PowerPoint, Excel, PDF, HTML, CAD files, raster images, and more. Additionally, the GroupDocs.Conversion Cloud API extends its document conversion family to include SDKs for .NET, Java, PHP, Ruby, Android, and Python, providing a wide range of options for utilizing its cloud-based conversion capabilities.

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