https://github.com/folkerkinzel/csvtools
.NET library for reading and writing CSV files (RFC 4180)
https://github.com/folkerkinzel/csvtools
csharp csv dotnet rfc-4180
Last synced: 3 months ago
JSON representation
.NET library for reading and writing CSV files (RFC 4180)
- Host: GitHub
- URL: https://github.com/folkerkinzel/csvtools
- Owner: FolkerKinzel
- License: mit
- Created: 2020-03-20T13:31:27.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2025-03-04T11:31:43.000Z (3 months ago)
- Last Synced: 2025-03-04T11:45:36.575Z (3 months ago)
- Topics: csharp, csv, dotnet, rfc-4180
- Language: C#
- Homepage:
- Size: 19.9 MB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# FolkerKinzel.CsvTools
[](https://www.nuget.org/packages/FolkerKinzel.CsvTools/)
[](https://github.com/FolkerKinzel/CsvTools/blob/master/LICENSE)
[](https://stand-with-ukraine.pp.ua)## .NET library for reading and writing CSV files (RFC 4180)
[Project Reference](https://folkerkinzel.github.io/CsvTools/reference/)Starting with version 2.0.0, mapping functionality and type converters
are in the separate package [FolkerKinzel.CsvTools.Mappings](https://www.nuget.org/packages/FolkerKinzel.CsvTools.Mappings/). This ensures that only what is really needed needs to be installed.You can use this small library independently
- for analyzing CSV files and CSV strings (delimiter, header row, column names, text encoding, and required options for reading non-standard CSV)
- retrieving the appropriate method arguments for exchanging CSV data with Excel
- serializing collections of any data and DataTables as CSV with simple formatting options (Use [FolkerKinzel.CsvTools.Mappings](https://www.nuget.org/packages/FolkerKinzel.CsvTools.Mappings/) for advanced CSV serializing and deserializing.)
- parsing the string content of CSV files and CSV strings, e.g., with Linq. (Use [FolkerKinzel.CsvTools.Mappings](https://www.nuget.org/packages/FolkerKinzel.CsvTools.Mappings/) for deserializing data tables and data types other than strings.)FolkerKinzel.CsvTools allows you to do things easily and with just a few lines of code. In addition, the library also provides the means to write high-performance code:
- It allows you to parse ultra large CSV files because only one row of the file has to be in memory at a time.
- It makes the fields of the CSV file available as `ReadOnlyMemory` instances. This avoids the allocation of numerous temporary strings.
- The `CsvOpts.DisableCaching` option allows reusing the same `CsvRecord` instance for each parsed row of the CSV file. This can avoid further allocations.(See [benchmark results](https://github.com/FolkerKinzel/CsvTools.Mappings/tree/master/src/Benchmarks/results) and the associated [benchmark code](https://github.com/FolkerKinzel/CsvTools.Mappings/tree/master/src/Benchmarks).)
### Code Examples
- [Converting object data to CSV](https://github.com/FolkerKinzel/CsvTools/blob/master/src/Examples/CsvStringExample.cs)
- [Serializing DataTable(s) as CSV](https://github.com/FolkerKinzel/CsvTools/blob/master/src/Examples/DataTableExample.cs)
- [Exchanging CSV data with Excel](https://github.com/FolkerKinzel/CsvTools/blob/master/src/Examples/DataTableExample.cs)
- [Analyzing and converting CSV files](https://github.com/FolkerKinzel/CsvTools/blob/master/src/Examples/CsvAnalyzerExample.cs)
- [Linq on CSV files](https://github.com/FolkerKinzel/CsvTools/blob/master/src/Examples/LinqOnCsvExample.cs)
- [The DisableCaching option](https://github.com/FolkerKinzel/CsvTools/blob/master/src/Examples/DisableCachingExample.cs)[Version History](https://github.com/FolkerKinzel/CsvTools/releases)