Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/changhuixu/delimiteddatafilehelper
Reader and Writer for Delimited Data File (CSV, tab/pipe delimited file, etc...)
https://github.com/changhuixu/delimiteddatafilehelper
csv delimited-data pipe reader tab writer
Last synced: about 2 months ago
JSON representation
Reader and Writer for Delimited Data File (CSV, tab/pipe delimited file, etc...)
- Host: GitHub
- URL: https://github.com/changhuixu/delimiteddatafilehelper
- Owner: changhuixu
- License: mit
- Created: 2017-03-26T04:01:44.000Z (almost 8 years ago)
- Default Branch: main
- Last Pushed: 2024-09-01T23:33:57.000Z (5 months ago)
- Last Synced: 2024-12-08T17:18:03.284Z (2 months ago)
- Topics: csv, delimited-data, pipe, reader, tab, writer
- Language: C#
- Homepage:
- Size: 53.7 KB
- Stars: 2
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Delimited Data File Helper
Reader and Writer for Delimited Data File (csv, tab/pipe delimited files)
![ ](https://github.com/changhuixu/DelimitedDataFileHelper/workflows/CI/badge.svg)
![NuGet](https://img.shields.io/nuget/v/uiowa.DelimitedDataHelper.svg?logo=nuget&style=flat-square)
[![Coverage Status](https://coveralls.io/repos/github/changhuixu/DelimitedDataFileHelper/badge.svg)](https://coveralls.io/github/changhuixu/DelimitedDataFileHelper)This is a demo library for my learning and practice purposes.
---
1. Why need to have this little library?
There are many csv libraries out there, but I still prefer to write my own. First reason is that it is not so difficult to write a reader and writer. Second, most of my files don't need cumbersome settings for reader and writer. I just want things become easy and simple.
2. Usage
- By default, csv file reader and writer will read and write "" quoted entries.
- By default, all delimited file reader will trim starting/ending white spaces of each entry.
- By default, all delimited file writer will write a header row in the output file.```c#
var data = new CsvFile("filename.csv").GetData();
data.WriteToCsvFile("output.csv");
```If you want to skip first n rows,
```c#
var data = new PipeDelimitedFile("input.csv")
.SkipNRows(1)
.GetData()
.ToList();
```If you don't want to trim starting/ending white spaces of each entry,
```c#
var data = new TabDelimitedFile("input.txt")
.SkipNRows(1)
.GetData(new DelimitedFileReaderConfig(false))
.ToList();
```If you don't want to write header in the output file,
```c#
var config = new CsvWriterConfig {WriteHeader = false};
data.WriteToCsvFile("output.csv", config);
```