Import Data from JSON to Excel

MS Excel provides a variety of features to keep and organize tabular data in the form of worksheets. Along with data organization, you can perform various operations such as data sorting, graph plotting, mathematical computations and etc. JSON, on the other hand, is a widely used format to store and transmit the data in the form of key-value pairs. In various cases, you receive the data in the form of JSON and need to import it into an Excel file. To achieve that programmatically, this article covers how to import JSON data to Excel in Java.

Java Library for JSON to Excel Import

Aspose.Cells for Java is a powerful API with an amazing set of features for creating and processing spreadsheet documents. In addition, it provides high-quality back and forth conversion of Excel files. You can download its JAR or install it directly using the following Maven configurations.


	<name>Aspose Java API</name>



Steps to Import JSON Data to Excel

The following are the steps to import data from a JSON file to an Excel workbook using Aspose.Cells for Java.

  • Read the JSON file from disk.
  • Create an Excel file.
  • Import data from JSON to Excel.
  • Save the Excel file to desired location.

Let’s have a look at how to transform the above-mentioned steps into the Java code to import JSON data to an Excel file.

Import JSON Data to Excel in Java

As you know that JavaScript Object Notation is a common data interchange format which is quite lightweight and can be read by human and machines easily. Now, for example, you get data from some Web API in JSON format and need it to be imported into some Excel file, then Aspose.Cells is there to provide this facility.

JSONUtility class is used for this purpose having an ImportData method that not only imports data from JSON to Excel but also performs different conversions and formatting using the JsonLayoutOptions object during the import process. You may try this exciting feature by following the article Importing Data from JSON.

The following code sample shows how to import data from JSON to Excel in Java:

You can see that the result is cool as a fully formatted Excel file is created without using any extra code to parse the JSON string from any source like Web API. Isn’t it? For example, if you get the following string from Web API, then the output Excel file is shown in the image below:

[{“color”: “red”,“value”: “#f00”},{“color”: “green”,“value”: “#0f0”},{“color”: “blue”,“value”: “#00f”},{“color”: “cyan”,“value”: “#0ff”},{“color”: “magenta”,“value”: “#f0f”},{“color”: “yellow”,“value”:"#ff0"},{“color”: “black”,“value”: “#000”}]

JSON to Excel Java

Java JSON to Excel Converter Library - Get a Free License

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


In this article, you have learned how to import JSON data to Excel files in Java. The code sample has demonstrated how you can integrate JSON to Excel import in your Java applications. In addition, you can visit the documentation to explore other features of Aspose.Cells for Java. Also, you can share your questions or queries with us via our forum.

See Also