VOOZH about

URL: https://www.nuget.org/packages/Csv/

⇱ NuGet Gallery | Csv 2.0.245




👁 Image
Csv 2.0.245

dotnet add package Csv --version 2.0.245
 
 
NuGet\Install-Package Csv -Version 2.0.245
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Csv" Version="2.0.245" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Csv" Version="2.0.245" />
 
Directory.Packages.props
<PackageReference Include="Csv" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Csv --version 2.0.245
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Csv, 2.0.245"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Csv@2.0.245
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Csv&version=2.0.245
 
Install as a Cake Addin
#tool nuget:?package=Csv&version=2.0.245
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

csv

👁 NuGet Version
👁 NuGet Downloads
👁 Build status
👁 codecov

Really simple csv library

This library targets .NET Standard 2.0, .NET 8.0, and .NET 9.0, with enhanced Span/Memory APIs available for .NET 8.0+.

Install

To install csv, use the following command in the Package Manager Console

PM> Install-Package Csv

Changelog

For a detailed list of changes and version history, see .

Basic Usage

More examples can be found in the tests.

Reading a CSV file

// NOTE: Library assumes that the csv data will have a header row by default, see CsvOptions.HeaderMode
/*
# comments are ignored
Column name,Second column,Third column
First cell,second cell,
Second row,second cell,third cell
*/ 
var csv = File.ReadAllText("sample.csv");
foreach (var line in CsvReader.ReadFromText(csv))
{
 // Header is handled, each line will contain the actual row data
 var firstCell = line[0];
 var byName = line["Column name"];
}

CsvReader also supports reading from a TextReader (CsvReader.Read(TextReader, CsvOptions)) or a Stream (CsvReader.ReadFromStream(Stream, CsvOptions))

For .NET 8.0+ the library exposes:

  • CsvReader.ReadAsync and CsvReader.ReadFromStreamAsync which return IAsyncEnumerable<ICsvLine>
  • CsvReader.ReadFromMemory to read from a ReadOnlyMemory<char> without allocating intermediate strings
  • CsvReader.ReadAsSpan, CsvReader.ReadFromStreamAsSpan, and CsvReader.ReadFromTextAsSpan which return IEnumerable<ICsvLineSpan> for zero-allocation Span/Memory access to CSV data
  • CsvReader.ReadFromMemoryOptimized with CsvMemoryOptions for high-performance scenarios using ArrayPool-based buffering
High-performance reading with Span/Memory (.NET 8.0+)
var csv = File.ReadAllText("sample.csv");
foreach (var line in CsvReader.ReadFromTextAsSpan(csv))
{
 // Access data as ReadOnlySpan<char> for zero allocations
 ReadOnlySpan<char> firstCell = line.GetSpan(0);
 ReadOnlySpan<char> byName = line.GetSpan("Column name");

 // Or as ReadOnlyMemory<char> if you need to store references
 ReadOnlyMemory<char> cellMemory = line.GetMemory(0);
}

CsvOptions can be used to configure the csv parsing:

var options = new CsvOptions // Defaults
{
 RowsToSkip = 0, // Allows skipping of initial rows without csv data
 SkipRow = (row, idx) => string.IsNullOrEmpty(row) || row[0] == '#',
 Separator = '\0', // Autodetects based on first row
 TrimData = false, // Can be used to trim each cell
 Comparer = null, // Can be used for case-insensitive comparison for names
 HeaderMode = HeaderMode.HeaderPresent, // Assumes first row is a header row
 AutoRenameHeaders = true, // Automatically renames duplicate headers (e.g., "A", "A2", "A3") and converts empty headers to "Empty", "Empty2", etc. Set to false to throw on duplicates.
 ValidateColumnCount = false, // Checks each row immediately for column count
 ReturnEmptyForMissingColumn = false, // Allows for accessing invalid column names
 Aliases = null, // A collection of alternative column names
 AllowNewLineInEnclosedFieldValues = false, // Respects new line (either \r\n or \n) characters inside field values enclosed in double quotes.
 AllowBackSlashToEscapeQuote = false, // Allows the sequence "\"" to be a valid quoted value (in addition to the standard """")
 AllowSingleQuoteToEncloseFieldValues = false, // Allows the single-quote character to be used to enclose field values
 NewLine = Environment.NewLine // The new line string to use when multiline field values are read (Requires "AllowNewLineInEnclosedFieldValues" to be set to "true" for this to have any effect.)
};

Writing a CSV file

With headers
var columnNames = new [] { "Id", "Name" };
var rows = new []
{
 new [] { "0", "John Doe" },
 new [] { "1", "Jane Doe" }
};
var csv = CsvWriter.WriteToText(columnNames, rows, ',');
File.WriteAllText("people.csv", csv);
/*
Writes the following to the file:

Id,Name
0,John Doe
1,Jane Doe
*/
Without headers
var rows = new []
{
 new [] { "0", "John Doe" },
 new [] { "1", "Jane Doe" }
};
// Convenience overload - no need to pass headers or skipHeaderRow
var csv = CsvWriter.WriteToText(rows);
File.WriteAllText("people.csv", csv);
/*
Writes the following to the file (no header row):

0,John Doe
1,Jane Doe
*/
Skipping headers
var columnNames = new [] { "Id", "Name" };
var rows = new []
{
 new [] { "0", "John Doe" },
 new [] { "1", "Jane Doe" }
};
// Pass null for headers and skipHeaderRow: true
// Column count is determined from the first data row
var csv = CsvWriter.WriteToText(null, rows, ',', skipHeaderRow: true);
Custom separator
var rows = new [] { new [] { "A", "B" }, new [] { "C", "D" } };
var csv = CsvWriter.WriteToText(rows, ';'); // semicolon separator
// Output: A;B
// C;D

CsvWriter also includes asynchronous overloads (WriteAsync and WriteToTextAsync) which operate on IAsyncEnumerable<string[]> and support passing a CancellationToken. For .NET 8.0+, memory-efficient overloads using ReadOnlyMemory<char> are available.

Helper extensions

CsvReader provides extension methods to work with the returned IEnumerable<ICsvLine>:

  • GetColumn(int columnNo) / GetColumn<T>(int columnNo, Func<string, T>) – extract a single column from all rows.
  • GetBlock(int row_start = 0, int row_length = -1, int col_start = 0, int col_length = -1) – get a rectangular subset of the data.

Status

👁 NuGet Version
👁 NuGet Downloads
👁 Build status
👁 codecov
👁 FOSSA Status

License

👁 FOSSA Status

Product Versions Compatible and additional computed target framework versions.
.NET net5.0 net5.0 was computed.  net5.0-windows net5.0-windows was computed.  net6.0 net6.0 was computed.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 is compatible.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 is compatible.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
.NET Core netcoreapp2.0 netcoreapp2.0 was computed.  netcoreapp2.1 netcoreapp2.1 was computed.  netcoreapp2.2 netcoreapp2.2 was computed.  netcoreapp3.0 netcoreapp3.0 was computed.  netcoreapp3.1 netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 netstandard2.0 is compatible.  netstandard2.1 netstandard2.1 was computed. 
.NET Framework net461 net461 was computed.  net462 net462 was computed.  net463 net463 was computed.  net47 net47 was computed.  net471 net471 was computed.  net472 net472 was computed.  net48 net48 was computed.  net481 net481 was computed. 
MonoAndroid monoandroid monoandroid was computed. 
MonoMac monomac monomac was computed. 
MonoTouch monotouch monotouch was computed. 
Tizen tizen40 tizen40 was computed.  tizen60 tizen60 was computed. 
Xamarin.iOS xamarinios xamarinios was computed. 
Xamarin.Mac xamarinmac xamarinmac was computed. 
Xamarin.TVOS xamarintvos xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (10)

Showing the top 5 NuGet packages that depend on Csv:

Package Downloads
Reo.Core.DataImport

Package Description

Zebra.Printer.SDK

The Zebra Link-OS SDK provides a powerful set of APIs enabling creation of desktop and mobile apps that take full advantage of the printer's operating system features including connectivity, printing and management tasks.

Prime

An F# code library for pure functional programming... and much more!

Prime.Scripting

A dynamic scripting language for .NET.

Khaos.Avalanche

Package Description

GitHub repositories (7)

Showing the top 7 popular GitHub repositories that depend on Csv:

Repository Stars
dotnet/ai-samples
darklinkpower/PlayniteExtensionsCollection
Collection of extensions made for Playnite.
mattfrear/Swashbuckle.AspNetCore.Filters
A bunch of useful filters for Swashbuckle.AspNetCore
tukasa0001/TownOfHost
Host only mod for Among Us.
amrshaheen61/UE4LocalizationsTool
simple tool to edit unreal engine 4 text files
akintos/UnrealLocres
UE4 localization resource file tool
laicasaane/tower_of_encosy
A sandbox to learn and play around
Version Downloads Last Updated
2.0.245 7,724 5/17/2026
2.0.217 70,274 1/3/2026
2.0.205 47,681 10/21/2025
2.0.170 77,783 5/20/2025
2.0.128 129,846 2/20/2025
2.0.93 1,268,942 12/10/2022
2.0.87 312,584 9/2/2022
2.0.84 178,429 5/4/2022
2.0.80 12,484 4/21/2022
2.0.76 1,293 4/21/2022
2.0.67 20,139 3/31/2022
2.0.65 55,094 1/18/2022
2.0.64 4,026 1/4/2022
2.0.62 216,221 12/24/2020
2.0.61 55,765 12/23/2020
Loading failed