how Reading/writing CSV/tab delimited files in c#
I need to read from a CSV/Tab delimited file and write to such a file as well from .net.
The difficulty is that I don’t know the structure of each file and need to write the cvs/tab file to a datatable, which the FileHelpers library doesn’t seem to support.
I’ve already written it for Excel using OLEDB, but can’t really see a way to write a tab file for this, so will go back to a library.
Can anyone help with suggestions?
I used this CsvReader, it is really great and well configurable. It behaves well with all kinds of escaping for strings and separators. The escaping in other quick and dirty implementations were poor, but this lib is really great at reading. With a few additional codelines you can also add a cache if you need to.
Writing is not supported but it rather trivial to implement yourself. Or inspire yourself from this code.