Sylvan.Data.Csv
1.1.16
Prefix Reserved
.NET 6.0
.NET Core 3.0
.NET Standard 2.0
Install-Package Sylvan.Data.Csv -Version 1.1.16
dotnet add package Sylvan.Data.Csv --version 1.1.16
<PackageReference Include="Sylvan.Data.Csv" Version="1.1.16" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Sylvan.Data.Csv --version 1.1.16
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Sylvan.Data.Csv, 1.1.16"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Sylvan.Data.Csv as a Cake Addin
#addin nuget:?package=Sylvan.Data.Csv&version=1.1.16
// Install Sylvan.Data.Csv as a Cake Tool
#tool nuget:?package=Sylvan.Data.Csv&version=1.1.16
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Sylvan.Data.Csv
A cross-platform .NET library for reading and writing CSV data files.
The CsvDataReader
provides readonly, row by row, forward-only access to the data.
Exposes a familiar API via DbDataReader
, which is ideal for accessing rectangular, tabular data sets.
Sylvan.Data.Csv is currently the fastest library for reading CSV data
in the .NET ecosystem.
Features
- Auto detect delimiters.
- Supports asynchronous IO.
- Strongly-typed accessors that avoid allocations.
- Supported types includes all standard .NET primitive types,
DateOnly
andTimeOnly
on .NET 6, - Binary data encoded with either base64 or hexadecimal.
- Supported types includes all standard .NET primitive types,
- Schema information to support database bulk-load operations.
Usage Examples
Basic
using Sylvan.Data.Csv;
// CsvDataReader derives from System.Data.DbDataReader
using CsvDataReader dr = CsvDataReader.Create("data.csv");
// iterate over the rows in the file.
while(dr.Read())
{
// iterate fields in row.
for(int i = 0; i < dr.FieldCount; i++)
{
var value = dr.GetString(i);
}
// Can use other strongly-typed accessors
// bool flag = edr.GetBoolean(0);
// DateTime date = edr.GetDateTime(1);
// decimal amt = edr.GetDecimal(2);
}
Bind CSV data to objects using Sylvan.Data.
using Sylvan.Data;
using Sylvan.Data.Csv;
using System.Linq;
using var dr = CsvDataReader.Create("data.csv");
IEnumerable<Record> records = dr.GetRecords<Record>();
Record[] allRecords = records.ToArray();
class Record {
public int Id { get; set; }
public string Name { get; set; }
public DateTime Date { get; set; }
public decimal Amount { get; set; }
}
Convert Excel data to CSV using Sylvan.Data and Sylvan.Data.Excel
using Sylvan.Data.Csv;
using Sylvan.Data;
using Sylvan.Data.Excel;
using System.Data.Common;
// create reader for excel data file
ExcelDataReader edr = ExcelDataReader.Create("example.xlsx");
// (optional) create data reader which allows variable-length rows
DbDataReader reader = edr.AsVariableField(edr => edr.RowFieldCount);
// create CSV writer to standard out
var csvWriter = CsvDataWriter.Create(Console.Out);
// write excel data as csv
csvWriter.Write(reader);
Product | Versions |
---|---|
.NET | net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows |
.NET Core | netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1 |
.NET Standard | netstandard2.0 netstandard2.1 |
.NET Framework | net461 net462 net463 net47 net471 net472 net48 |
MonoAndroid | monoandroid |
MonoMac | monomac |
MonoTouch | monotouch |
Tizen | tizen40 tizen60 |
Xamarin.iOS | xamarinios |
Xamarin.Mac | xamarinmac |
Xamarin.TVOS | xamarintvos |
Xamarin.WatchOS | xamarinwatchos |
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 3.0
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net6.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Sylvan.Data.Csv:
Package | Downloads |
---|---|
Sylvan.Data.CsvZip
A .NET library implementing the csvz specification. |
|
Sylvan.AspNetCore.Mvc.Formatters.Csv
ASP.NET formatter for text/csv content negotiation. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
1.1.16 | 1,631 | 6/14/2022 | |
1.1.15 | 392 | 6/2/2022 | |
1.1.14 | 115 | 6/1/2022 | |
1.1.13 | 15,143 | 3/31/2022 | |
1.1.12 | 9,883 | 2/18/2022 | |
1.1.11 | 4,018 | 1/5/2022 | |
1.1.10 | 1,669 | 12/9/2021 | |
1.1.9 | 8,588 | 10/23/2021 | |
1.1.8 | 14,016 | 9/8/2021 | |
1.1.7 | 1,644 | 8/14/2021 | |
1.1.6 | 180 | 8/13/2021 | |
1.1.5 | 256 | 8/8/2021 | |
1.1.4 | 359 | 8/5/2021 | |
1.1.3 | 1,680 | 7/23/2021 | |
1.1.2 | 229 | 7/19/2021 | |
1.1.1 | 243 | 7/15/2021 | |
1.1.0 | 248 | 7/14/2021 | |
1.0.3 | 1,330 | 5/21/2021 | |
1.0.2 | 215 | 5/15/2021 | |
1.0.1 | 1,028 | 5/4/2021 | |
1.0.0 | 322 | 4/5/2021 | |
0.10.1 | 233 | 3/27/2021 | |
0.10.0 | 463 | 3/15/2021 | |
0.9.2 | 344 | 1/31/2021 | |
0.9.1 | 227 | 1/25/2021 | |
0.9.0 | 411 | 1/9/2021 | |
0.8.3 | 174 | 1/6/2021 | |
0.8.2 | 225 | 1/4/2021 | |
0.8.1 | 178 | 1/3/2021 | |
0.8.0 | 317 | 11/30/2020 | |
0.7.4 | 254 | 9/28/2020 | |
0.7.2 | 3,092 | 9/11/2020 | |
0.7.0 | 318 | 9/10/2020 | |
0.6.3 | 295 | 8/10/2020 | |
0.6.2 | 310 | 8/7/2020 | |
0.6.1 | 274 | 8/4/2020 | |
0.6.0 | 309 | 8/3/2020 | |
0.5.0 | 294 | 6/30/2020 | |
0.4.5 | 295 | 6/25/2020 | |
0.4.4 | 320 | 6/25/2020 | |
0.4.3 | 527 | 6/10/2020 | |
0.4.2 | 413 | 5/29/2020 | |
0.4.1 | 312 | 5/2/2020 | |
0.4.0 | 320 | 4/29/2020 | |
0.3.4 | 328 | 4/21/2020 | |
0.3.3 | 304 | 4/16/2020 | |
0.3.2 | 255 | 4/15/2020 | |
0.3.1 | 296 | 4/13/2020 | |
0.3.0 | 288 | 4/10/2020 | |
0.2.1 | 395 | 4/7/2020 | |
0.2.0 | 276 | 4/7/2020 | |
0.1.2 | 297 | 4/7/2020 | |
0.1.1 | 282 | 4/6/2020 | |
0.1.0 | 490 | 4/4/2020 |