Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSV parser/reader for C#? [closed]

Tags:

c#

csv

is there a good and free implementation of CSV parser available under some liberal licence? Some counterpart of SuperCSV for Java, perhaps a port?

like image 661
Bartosz Radaczyński Avatar asked May 25 '09 14:05

Bartosz Radaczyński


People also ask

How do I read a CSV file in C sharp?

In C#, StreamReader class is used to deal with the files. It opens, reads and helps in performing other functions to different types of files. We can also perform different operations on a CSV file while using this class. OpenRead() method is used to open a CSV file and ReadLine() method is used to read its contents.

How do I read a specific column in a CSV file in C ++?

You need to parse the CSV file. My guess is that you can assume that none of the CSV fields contain a ',' or a newline. If so, then parsing is simple: just read line by line using std::getline into a std::string, then parse the string into tokens with ',' as the delimiter.

What is CSV format?

A CSV (comma-separated values) file is a text file that has a specific format which allows data to be saved in a table structured format.


2 Answers

FileHelpers Open Source Library.

like image 120
Keltex Avatar answered Sep 22 '22 04:09

Keltex


There's a nice implementation on CodeProject:

To give more down to earth numbers, with a 45 MB CSV file containing 145 fields and 50,000 records, the reader was processing about 30 MB/sec. So all in all, it took 1.5 seconds! The machine specs were P4 3.0 GHz, 1024 MB.

like image 22
Anton Gogolev Avatar answered Sep 21 '22 04:09

Anton Gogolev