Default Header/Column name when csv file has no header #1625
Unanswered
davidlukas
asked this question in
Q&A
Replies: 1 comment
-
csv.Configuration.GetDynamicPropertyName = (context, fieldIndex) => $"sfx{fieldIndex + 1}"; |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I'm reading .csv files without headers. The csvhelper configuration for header:
HasHeaderRecord = false,
The files are read as dynamic records, since the amount of columns/types vary.
var data = csvReader.GetRecords().ToList();
CsvHelper creates these dynamic records, setting the field/column name as Field1, Field2 and so forth. Is there a way to give the fieldname/column a different default name like sfx1, sfx2 ?
Beta Was this translation helpful? Give feedback.
All reactions