Home

Parsing CSV with LinqPad (mini tutorial)

Hi,

If anyone is interested I've written a blog post covering a simple technique for reading CSV with LinqPad. It'll cover simple CSV files, I'm thinking of covering other techniques in more depth (perhaps quoted CSV etc) if it's well received.

Drop me a comment on the post if you like it, as I'll see it quicker.

Comments

  • Thanks for the mini tutorial!

    It's just what I was looking for to get me started with Linqpad!
  • Now that it has NuGet support, IMHO it's better/simpler to just add one of the existing libraries via NuGet. I've found out the hard way that CSV parsing is much harder than it looks (quoting, escaping, newlines, malformed data, different encodings, etc :)

    https://nuget.org/packages?q=csv
  • I agree, I might whip together a tutorial for using some good CSV parsing libraries. But for those not using the premium edition (though a great reason to upgrade), it still might come in useful.

    I wonder if it's going to be be baked in soon, seeing as the new beta can write CSV, I wonder if it'll soon be able to read CSV as well :-)
  • I really like using FileHelpers Library. You can specify everything out, custom validate on parsing, and you get a nice clean object list back of your class type. Iterate through and do what you want. Plus I love that it validates the file before I start doing something. Nothing sucks more than figuring out that you did something to 75% of the file just to have one thing in the file blow up your code.
Sign In or Register to comment.