I have a CSV file that is exported from another system in which column orders and definitions can change. I found that FileHelpers is ideal for reading csv files, but it seems you cannot use it unless you know the column ordering before compiling the application. I want to know if it is even possible to use FileHelpers in an unprinted way. I am currently using it to read a file, but then everything else I do manually, so I have a class:
[DelimitedRecord(",")] public class CSVRow { public string Content { get; set; } }
This means that each line is within Content , which is great since I split the line, etc., however now I am having problems with this method due to the commas inherent in the file, so the line may be:
"something",,,,0,,1,,"something else","","",,,"something, else"
My simple comma separation on this line does not work, because in `` something that is, there is a comma that divides. Obviously, there is something like FileHelpers in which they are really useful in analyzing these values ββand taking into account quotation marks. So is it possible to use FileHelpers in this way without a known column definition, or at least pass a csv string to it and get the list of values ββback, or is there a good library that does this?
source share