c# - How to read a header from a specific line with CsvHelper? -
i'm trying read csv file header @ row 3:
some crap line empty line col1,col2,col3,... val1,val2,val3 val1,val2,val3
how tell csvhelper header not @ first row?
i tried skip 2 lines read()
succeeding call readheader()
throws exception header has been read.
using (var csv = new csvreader(new streamreader(stream), csvconfiguration)) { csv.read(); csv.read(); csv.readheader(); .....
if set csvconfiguration.hasheaderrecord
false
readheader()
fails again.
try this:
using (var reader = new streamreader(stream)) { reader.readline(); reader.readline(); using (var csv = new csvreader(reader)) { csv.readheader(); } }
Comments
Post a Comment