CsvHelper

A .NET library for reading and writing CSV files. Extremely fast, flexible, and easy to use.

Features


Fast

Compiles classes on the fly for extremely fast performance.

Flexible

Conservative when writing, liberal when reading.

Easy to Use

Reading and writing is as simple as GetRecords<T>() and WriteRecords(records). No configuration required.

Highly Configurable

Feature rich mapping and attribute systems to configure any type of CSV file to any type of class.

RFC 4180 Compliant

Adheres to the RFC 4180 standard to ensure compatibility across systems.

Linux Mode

Mode for common Linux/SerDe files where an escape character is used instead of RFC 4180's field quoting.

Graceful Fallback

When non-standard files are read, fallback will match MS Excel parsing.

Low Memory Usage

Reading records will yield results so only one record is in memory at a time.

Field Caching

Option to use field caching when there is repeated data in a CSV file. This will reduce memory and speed up parsing time.

Run Anywhere

CsvHelper is built on .NET Standard 2.0 which allows it to run almost everywhere. Older versions of .NET are possible if needed.

Open Source

Many contributors have helped make CsvHelper the great library it is today. Completely free for commercial use. Dual licensed under MS-PL and Apache 2.


Help


Stack Overflow

Stack Overflow has millions of users in its community just waiting to answer your questions. There is only one of me and I'm pretty busy.

Documentation

Learn how to use CsvHelper using the API reference or check out some examples.

Features Requests and Bugs

If you have a feature request or have found a bug, you can log an issue. Please use Stack Overflow if you have a question.


License


Completely free for commercial use. Dual licensed. Choose which ever license suits your needs.

Microsoft Public License (MS-PL)

Apache License, Version 2.0



Contributions


Want to contribute? Great! Here are a few guidelines.

  1. If you want to do a feature, post an issue about the feature first. Some features are intentionally left out, some features may already be in the works, or I may have some advice on how I think it should be done. I would feel bad if time was spent on some code that won't be used.
  2. If you want to do a bug fix, it might not be a bad idea to post about it too. I've had the same bug fixed by multiple people at the same time before.
  3. All code should have a unit test. If you make a feature, there should be significant tests around the feature. If you do a bug fix, there should be a test specific to that bug so it doesn't happen again.
  4. Pull requests should have a single commit. If you have multiple commits, squash them into a single commit before requesting a pull.
  5. When in Rome: Try and follow the code styling already in place. I use default Visual Studio Text Editor settings but change tabs to Keep tabs.

Contributors





Donations


GitHub Sponsors

You can do one time or recurring donations through GitHub Sponsors.


Sponsors


A huge thanks to the .NET on AWS Open Source Software Fund for sponsoring CsvHelper!


Thanks to Microsoft for being a sponsor!