Import Data from JSON to Excel on Linux using .NET

Convert JSON to Excel Linux

MS Excel is a rich spreadsheet manipulation software that allows you to organize the data in the form of worksheets and workbooks. Alongside, it provides features such as data sorting, graph plotting, mathematical computations and etc. On the other hand, JSON is a popular format to store structured data. In certain cases, JSON data needs to be converted to Excel worksheets. For such cases, this article shows how to import data from JSON files to Excel worksheets on Linux.

.NET JSON to Excel Converter API for Linux

For importing data from JSON files to Excel worksheets, we will use Aspose.Cells for .NET. It is a feature-rich API that allows you to create, manipulate, and convert Excel files. In order to use this API on Linux, you need to set up .NET environment, which can be done within a few steps. The following are the prerequisites that you would need to set up the environment.

Once you have set up the environment and created the application, you can proceed to install Aspose.Cells for .NET via NuGet using NuGet Package Manager extension for Visual Studio Code.

Learn how to create a console application on Linux using Visual Studio Code.

Import Data from JSON to Excel on Linux

The following are the steps to import data from JSON to Excel XLSX:

The following code sample shows how to import data from JSON to Excel on Linux.

Input JSON Data

[
   {
       Name: "John Smith",
       Contract:
       [
           {
               Client:
               {
                   Name: "A Company"
               },
               Price: 1200000
           },
           {
               Client:
               {
                   Name: "B Ltd."
               },
               Price: 750000
           },
           {
               Client:
               {
                   Name: "C & D"
               },
               Price: 350000
           }
       ]
   },
   {
       Name: "Tony Anderson",
       Contract:
       [
           {
               Client:
               {
                   Name: "E Corp."
               },
               Price: 650000
           },
           {
               Client:
               {
                   Name: "F & Partners"
               },
               Price: 550000
           }
       ]
   },
   {
       Name: "Jimmy Adams",
       Contract:
       [
           {
               Client:
               {
                   Name: "MIT"
               },
               Price: 800000
           },
           {
               Client:
               {
                   Name: "SnB"
               },
               Price: 520000
           }
       ]
   },
]

Output Excel Worksheet

JSON to Excel Linux

Import JSON to Excel with Formatting Styles

While importing the data from the JSON file, you can apply styles to the output Excel file. The following are the steps to perform this operation.

The following code sample shows how to apply styles while importing data from JSON to Excel on Linux.

Output Excel Worksheet

JSON to Excel Linux

Get a Free License

You can get a temporary license and use Aspose.Cells for .NET without evaluation limitations.

Conclusion

In this article, you have learned how to import JSON data to Excel worksheets on Linux. In addition, you have seen how to apply styles in JSON to Excel conversion. Furthermore, you can explore more about Aspose.Cells for .NET using the documentation. Also, you can ask your questions via our forum.

See Also