budul.CsvHelper.Excel
1.0.1
dotnet add package budul.CsvHelper.Excel --version 1.0.1
NuGet\Install-Package budul.CsvHelper.Excel -Version 1.0.1
<PackageReference Include="budul.CsvHelper.Excel" Version="1.0.1" />
<PackageVersion Include="budul.CsvHelper.Excel" Version="1.0.1" />
<PackageReference Include="budul.CsvHelper.Excel" />
paket add budul.CsvHelper.Excel --version 1.0.1
#r "nuget: budul.CsvHelper.Excel, 1.0.1"
#:package budul.CsvHelper.Excel@1.0.1
#addin nuget:?package=budul.CsvHelper.Excel&version=1.0.1
#tool nuget:?package=budul.CsvHelper.Excel&version=1.0.1
CsvHelper.Excel
CsvHelper.Excel is a .NET library that enables reading and writing Excel files (.xlsx) using CsvHelper conventions, powered by ClosedXML. It provides seamless integration for treating Excel worksheets as CSV-like data, supporting both synchronous and asynchronous operations.
This project is a fork of CsvHelper.Excel by Chris Young.
Features
- Read and write Excel files using CsvHelper-style APIs
- Support for multiple worksheets (read/write)
- Synchronous and asynchronous methods
- Customizable parsing and writing options (headers, sheet selection, row limits, etc.)
- Validation of Excel structure against POCOs
- Batch processing and progress reporting for large datasets
- Formula injection protection
Installation
Add the NuGet package to your project:
dotnet add package CsvHelper.Excel
Usage
Writing to Excel
using CsvHelper.Excel.Writer;
var records = new List<MyRecord> { /* ... */ };
records.WriteToExcel("output.xlsx", "Sheet1");
Reading from Excel
using CsvHelper.Excel.Parser;
var records = "output.xlsx".ReadFromExcel<MyRecord>("Sheet1");
Asynchronous Operations
await records.WriteToExcelAsync("output.xlsx", "Sheet1");
var records = await "output.xlsx".ReadFromExcelAsync<MyRecord>("Sheet1");
Advanced Options
You can use WriterOptions and ParserOptions to customize behavior, such as sheet name, header presence, row limits, and progress reporting.
Example: Integration Test
// Write records to Excel
await records.WriteToExcelAsync("data.xlsx", "DataSheet");
// Read records back from Excel
var readRecords = await "data.xlsx".ReadFromExcelAsync<MyRecord>("DataSheet");
Requirements
- .NET Standard 2.1, .NET 6, .NET 7, or .NET 8
- CsvHelper >= 30.0.1
- ClosedXML >= 0.101.0
Limitations
- Multi-sheet writing is supported, but reading/writing multiple sheets in a single operation may require manual handling.
- Excel's row and column limits apply (1,048,576 rows, 16,384 columns).
License
See LICENSE for details.
Contributions and issues are welcome!
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- ClosedXML (>= 0.105.0)
- CsvHelper (>= 33.1.0)
- System.Linq.Async (>= 6.0.3)
-
net6.0
- ClosedXML (>= 0.105.0)
- CsvHelper (>= 33.1.0)
- System.Linq.Async (>= 6.0.3)
-
net7.0
- ClosedXML (>= 0.105.0)
- CsvHelper (>= 33.1.0)
- System.Linq.Async (>= 6.0.3)
-
net8.0
- ClosedXML (>= 0.105.0)
- CsvHelper (>= 33.1.0)
- System.Linq.Async (>= 6.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.