convert csv to excel node.js

CSV format is widely used to import or export large datasets from one application to another. However, in some cases, you may need to convert CSV files to Excel XLSX or XLS. Likewise, vice versa can also be required in certain scenarios. Following that, this article covers how to convert CSV to Excel and Excel to CSV in Node.js.

Node.js CSV to Excel or Excel to CSV Converter

For back and forth conversion of CSV and Excel formats, we’ll use Aspose.Cells for Node.js via Java. It is a powerful and feature-rich API for the manipulation of spreadsheet formats from within the Node.js applications. You can either download the API’s package or install it using the following NPM command.

 > npm install aspose.cells

Convert CSV to Excel XLS in Node.js

The following are the steps to convert a CSV file to Excel XLS in Node.js.

The following code sample shows how to convert CSV to Excel XLSX in Node.js.

Sample CSV

My Data,,,,,,,

Items A,Items B,Items C,Items D,Items E,Items F,Items G,Items H
12,23,33,66,11,87,99,33
23,22,33,77,31,22,45,56
34,11,12,23,22,34,11,12
45,43,54,88,36,45,45,37
65,65,65,65,13,65,9,35
34,22,27,22,32,23,23,32
213,186,224,341,145,276,232,205

CSV to Excel

csv to excel or excel to csv node.js

Convert Excel XLS to CSV in Node.js

The following are the steps to convert XLSX or XLS file to CSV in Node.js.

The following code sample shows how to convert Excel XLSX or XLS to CSV.

Online CSV and Excel Converter Tools

We also provide online tools to convert CSV to Excel and Excel to CSV, which are based on Aspose.Cells. These are free tools and you can use them without signing up.

Get Free Excel and CSV Converter API

In order to use the API without evaluation limitations, you can get a free temporary license.

Conclusion

In this article, you have learned how easy it is to convert CSV to Excel or Excel to CSV in Node.js applications. In addition, we have provided you with online tools to convert Excel to CSV and CSV to Excel. These are free tools and you can use them without creating any account.

You can explore more about the Node.js Excel API using the documentation. In case you would have any queries, feel free to let us know via our forum.

See Also