https://github.com/bytedev/bytedev.csv
Simple library to help in the reading and writing of CSV formatted content.
https://github.com/bytedev/bytedev.csv
Last synced: 6 months ago
JSON representation
Simple library to help in the reading and writing of CSV formatted content.
- Host: GitHub
- URL: https://github.com/bytedev/bytedev.csv
- Owner: ByteDev
- License: mit
- Created: 2020-07-27T08:54:13.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-27T08:56:49.000Z (over 5 years ago)
- Last Synced: 2025-08-01T05:43:59.375Z (6 months ago)
- Language: C#
- Size: 412 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://ci.appveyor.com/project/bytedev/ByteDev-Csv/branch/master)
[](https://www.nuget.org/packages/ByteDev.Csv)
[](https://github.com/ByteDev/ByteDev.Csv/blob/master/LICENSE)
# ByteDev.Csv
Simple library to help in the reading and writing of CSV formatted content.
**Note:** this is just a pet project and has not been tested with large CSV data sets.
There are lots of other .NET CSV readers/writers out there, see: [Google](https://www.google.com/search?q=c%23+best+csv+reader)
and [StackOverflow](https://stackoverflow.com/questions/1941392/are-there-any-csv-readers-writer-libraries-in-c).
## Installation
ByteDev.Csv has been written as a .NET Standard 2.0 library, so you can consume it from a .NET Core or .NET Framework 4.6.1 (or greater) application.
ByteDev.Csv is hosted as a package on nuget.org. To install from the Package Manager Console in Visual Studio run:
`Install-Package ByteDev.Csv`
Further details can be found on the [nuget page](https://www.nuget.org/packages/ByteDev.Csv/).
## Release Notes
Releases follow semantic versioning.
Full details of the release notes can be viewed on [GitHub](https://github.com/ByteDev/ByteDev.Csv/blob/master/docs/RELEASE-NOTES.md).
## Usage
Example of reading an existing CSV file:
```csharp
ICsvFileReader reader = new CsvFileReader();
CsvFile csvFile = reader.ReadFile(@"C:\people.csv", new CsvFileReaderOptions { HasHeader = true });
Console.WriteLine(csvFile.Header.Line);
Console.WriteLine(csvFile.Body.Lines[0].Line);
Console.WriteLine(csvFile.Body.Lines[1].Line);
```
Example of creating and writing a CSV file:
```csharp
var header = new CsvFileLine("Name,Age");
var body = new CsvFileBody(new List
{
new CsvFileLine("John,20"),
new CsvFileLine("Joe,30")
});
var csvFile = new CsvFile(header, body);
ICsvFileWriter writer = new CsvFileWriter();
writer.Write(@"C:\people.csv", csvFile);
```