JSON is a popular format to exchange data within or between the applications. The lightweight JSON files make it possible for you to store and process small or large sized data easily. On the other hand, Excel XLS files are commonly used to keep and share the data. However, in certain cases, you may need to convert XLS data to JSON format from within .NET applications. To achieve that, this article covers how to convert XLS to JSON programmatically in C#.
Easy Steps to Convert XLS to JSON in C#
To convert the XLS files to JSON format in C#, we will use Aspose.Cells for .NET. The library hides the complex conversion operations and lets you convert XLS files to JSON format within a couple of steps. The following simple steps would be required to convert an XLS file to JSON.
- Load the XLS file from disk.
- Save it in JSON format to desired location.
The following section demonstrates how to download or install Aspose.Cells for .NET.
C# XLS to JSON Export Library – Free Download
Aspose.Cells for .NET is a high-speed and powerful library to create and process Excel files seamlessly. In addition, it provides a high fidelity converter for back and forth conversion of XLS files. You can download it’s DLL from the downloads section or install it from NuGet.
PM> Install-Package Aspose.Cells
Convert XLS to JSON in C#
In XLS to JSON conversion, Aspose.Cells for .NET converts each row of the worksheet into an object of JSON. The following are the steps to convert an XLS file to JSON in C#.
- Load the XLS file using Workbook class by specifying its path.
- Save XLS file into JSON format using Workbook.Save method.
The following code sample shows how to perform XLS to JSON export in C#.
C# Library for XLS to JSON Export - Get a Free License
You can get a free temporary license to use all the features of Aspose.Cells for .NET without any limitations.
Conclusion
In this article, you have learned how to convert XLS files to JSON format programmatically in C#. You can simply install Aspose.Cells for .NET into your applications and perform XLS to JSON export in C# within a couple of steps. Furthermore, you may go through the documentation of Aspose.Cells for .NET to explore other features. In case you would have any queries, please feel free to contact us at the forum.