i have a streamreader which loads up a csvfile, the issue is that there is one extra row at the top of the data that i want to ignore.
I am using the CSVReader project which is great but
csv.GetFieldHeaders();
always looks at the first row. Instead of going into the CSVReader source code and changing it, i thought it might be easier if i can "strip" out this first row from the streamreader itself before injecting it into the csvReader. Is this possible?
Just read a line from the SR before you pass it to the CSVReader constructor. For example:
using (var sr = new StreamReader("data.csv")) {
sr.ReadLine();
using (var csv = new CsvReader(sr, true)) {
// etc..
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With