Skip to content

SyncfusionExamples/excel-to-json

Repository files navigation

excel-to-json

This repository demonstrates how to convert Excel data into JSON format using Syncfusion XlsIO in a C# ASP.NET Core application.

The project includes a controller that loads Excel files, processes worksheets and ranges, and exports the content as JSON streams that can be consumed by web applications. The examples highlight three conversion modes: saving the entire workbook as JSON, saving a single worksheet as JSON, and saving a specific range as JSON. The converted JSON data is parsed with Newtonsoft JObject and bound to a DataGrid for display in the web interface, with support for multiple tabs when multiple worksheets are included. The repository also contains a helper class (CustomDynamicObject) that enables dynamic binding of JSON properties to objects, allowing flexible handling of varying column names and values. This makes it possible to work with Excel data in a dynamic way once converted to JSON. The project demonstrates how to instantiate the Excel engine, open workbooks, access worksheets and ranges, and call SaveAsJson methods to produce JSON streams. It also shows how to parse the JSON and bind the results to collections for rendering in the UI. The output can be customized based on user selection, providing a versatile solution for exporting Excel data into JSON format for modern applications. This repository serves as a reference for developers who want to integrate Excel-to-JSON conversion into their ASP.NET Core projects, enabling seamless transformation of spreadsheet data into structured JSON objects that can be consumed by web components, APIs, or other services. By following the examples, developers can adapt the approach to their own scenarios, ensuring that Excel data is quickly and accurately converted into JSON with consistent formatting and layout.

About

This repository contains the example of converting an Excel document to a JSON stream in C#, using Syncfusion Excel library (XlsIO).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors