Comma-separated values (CSV) library for .NET

Read and modify existing CSV file:
var csv = new Csv();
csv.LoadUtf8File("c:\\data.csv");
MessageBox.Show(csv.ToString());
								
Create new CSV file:
var csv = new Csv();
csv.LineCount = 10;
for (int i = 0; i < csv.LineCount; ++i)
{
  csv.SetFieldCount(i, 3);
  for (int j = 0; j < csv.FieldCount(i); ++j)
    csv[i, j] = "Field " + i + " " + j;
}

csv.ToUtf8File("c:\\new.csv");
								
Use fast CsvWriter to create CSV file without in-memory overhead of Csv class:
using (var writer = new CsvWriter("c:\\export.csv"))
{
  writer.Write("Field 1 1");
  writer.Write("Field 1 2");
  writer.Write("Field 1 3");

  writer.NextLine();

  writer.Write("Field 2 1");
  writer.Write("Field 2 2");
  writer.Write("Field 2 3");

  writer.NextLine();

  writer.Write("Field 3 1");
  writer.Write("Field 3 2");
  writer.Write("Field 3 3");
}
								
  • read and modify existing csv files
  • create new csv files
  • optimized for large data
  • selectable field separator
  • selectable CR/LF/CRLF output
  • selectable enclosing character
  • optional white space enclosing
  • optimized output, enclosing character emitted "as needed"
  • UTF-8 and ANSI files supported
  • lines with variable number of fields supported
  • insertion and deletion of lines and fields supported
  • available for .NET 2 - 4.7
  • source code included in registered version
  • royalty free distribution in applications

Download and order

Order CSV.NET library $60 USD (license for one developer)
Order CSV.NET multi-license $180 USD (license for all developers in the company)
Order CSV.NET year upgrades $30 USD (registered users only)
Order CSV.NET year upgrades multi-license $90 USD (registered multi-license users only)

Related links