Json2ExcelMiddleware allows you to effortlessly convert your .NET controller's JSON responses into Excel files with minimal setup.
Install the package via NuGet:
Install-Package Json2ExcelMiddleware -Version 1.2.4
- Configure Middleware
Add the following line to theConfigure
method in yourStartup.cs
afterapp.UseRouting()
:app.UseJson2Excel();
- Set Header
Include this header in your HTTP request:
x-excel:1
That’s it! The middleware works with all HTTP methods (GET, POST, PUT, etc.).
A typical JSON response:
[
{ "Name": "Alice", "Age": 25 },
{ "Name": "Bob", "Age": 30 }
]
Downloadable Excel file with the same data!
This project is licensed under Apache License