I recently had some pretty ugly CSV files to parse and decided to have a quick look around to see if there were any libraries around that would handle the specifics of these particular CSV files without me having to write yet another CSV parsing class. I found a couple that seemed to fit the bill on Code Project and I downloaded them both. The two specific ones that I looked at were Sebastien Lorien’s Fast CSV Reader and Andrew Rissing’s Generic Parser. The first one I tried was the Fast CSV Reader since it had some nice looking performance metrics on the Code Project page. Unfortunately, it blew up on the first file and I decided to give the other parser a try rather than trying to debug why Fast CSV Reader choked.
I next tried the Generic Parser and it handled the file and even managed to return me just my specific data and skipped all the miscellaneous comments and headers in the CSV files using just the default settings. On a couple of the CSV files, I made a few tweaks to the default settings of Generic Parser to get the exact data values I needed. So far, it has performed like a champ.
There are many CSV parsers out there that are part of larger libraries of utilities and such, but for a quick solution to CSV parsing, I would definitely recommend having a look at Andrew Rissing’s Generic Parser. I’d love to hear other’s experiences and recommendations for CSV parsing libraries.