Convert JSON to Excel Node.js

MS Excel provides a wide range of features to keep and organize data in the form of worksheets contained by workbooks. In addition to the data organization, it lets you perform sorting, data visualization, mathematical computations and etc. In certain cases, you receive data in JSON format and you need to export it to Excel worksheets programmatically. For such cases, this article covers how to convert JSON to Excel XLSX XLS in Node.js.

Node.js JSON to Excel Converter - Free Download

Aspose.Cells for Node.js is a powerful library that lets you create, modify or convert Excel files in Node.js applications. We will use this library to import data from JSON to Excel worksheets. You can either download the library’s package or install it using the following NPM command.

> npm install aspose.cells

Convert JSON to Excel in Node.js

The following are the steps to convert JSON data to Excel in Node.js:

The following code sample shows how to convert a JSON file to XLS in Node.js.

Input JSON Data

[{"nodeId":1,"reputation":1134},{"nodeId":2,"reputation":547},{"nodeId":3,"reputation":1703},{"nodeId":4,"reputation":-199},{"nodeId":5,"reputation":-306},{"nodeId":6,"reputation":-49},{"nodeId":7,"reputation":1527},{"nodeId":8,"reputation":1223}]'

Output Excel Worksheet

JSON to Excel Node.js

Node.js JSON to XLSX with Styles

You can also apply styles in JSON to Excel conversion using Aspose.Cells for Node.js via Java. For example, you can set font, color, alignment, border styles, etc. The following are the steps to apply styles while importing data from JSON to Excel in Node.js.

The following code sample applies styles when converting data from JSON to Excel in Node.js.

Output Excel Worksheet

JSON to XLSX Node.js

Import JSON Data to Excel Online

Use our free online JSON to Excel converter, which is based on Aspose.Cells. No need to create an account or subscribe to anything.

Free Node.js JSON to Excel Converter

You can get a free temporary license to use Aspose.Cells for Node.js without evaluation limitations.

Conclusion

JSON files are immensely used to store and share the data among different applications. Often, you need to export data from JSON files to Excel worksheets. Accordingly, in this article, you have learned how to convert JSON to Excel XLSX or XLS in Node.js. Also, you have seen how to apply formatting in JSON to Excel conversion.

In order to explore more about Aspose.Cells for Node.js via Java, visit the documentation. Furthermore, you can ask your questions via our forum.

See Also