https://github.com/ignatandrei/RSCG_WebAPIExports
Add exports to file to WebAPI ( for the moment, just Excel / xlsx)
https://github.com/ignatandrei/RSCG_WebAPIExports
Last synced: 3 days ago
JSON representation
Add exports to file to WebAPI ( for the moment, just Excel / xlsx)
- Host: GitHub
- URL: https://github.com/ignatandrei/RSCG_WebAPIExports
- Owner: ignatandrei
- License: mit
- Created: 2023-08-15T15:48:57.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-10T18:53:17.000Z (about 1 month ago)
- Last Synced: 2025-04-10T13:16:18.801Z (10 days ago)
- Language: C#
- Size: 60.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- RSCG_Examples - https://github.com/ignatandrei/RSCG_WebAPIExports/
README
[](https://www.nuget.org/packages/RSCG_WebAPIExports/)
# RSCG_WebAPIExports
Add exports to file to WebAPI ( for the moment, just Excel / xlsx)
## How to use in WebAPI project
Add reference to the package in the .csproj
```xml```
or
```xml```
Then in the WebAPI add
```csharp
using WebApiExportToFile;
//code
// Add services to the container.
//WebApiExportToFile.AddExport(builder.Services);
builder.Services.AddExport();
var app = builder.Build();
app.UseExport();```
Add to any url : .xlsx or .csv ( e.g.
for /WeatherForecast put /WeatherForecast.xlsx
for /WeatherForecast/GetPerson?id=23 put /WeatherForecast/GetPerson.xlsx?id=23
)
and the excel will be downloaded
## Examples
JSON value type array:
https://tiltwebapp.azurewebsites.net/api/PublicTILTs/PublicTiltsURLExcel:
https://tiltwebapp.azurewebsites.net/api/PublicTILTs/PublicTiltsURL.xlsxJSON object array:
https://tiltwebapp.azurewebsites.net/api/PublicTILTs/LatestTILTs/ignatandrei/10Excel:
https://tiltwebapp.azurewebsites.net/api/PublicTILTs/LatestTILTs/ignatandrei/10.xlsx