I have a class
public class AccCsv
{
public string IdNumber { get; set; }
public string Firstname { get; set; }
public string Lastname { get; set; }
public string AccountNumber { get; set; }
}
I am trying to read these values from an excel document. My service for reading the doc looks like so
public List<debtorCsv> GetAllDebtorImportedData(string path)
{
List<AccCsv> records;
using (var reader = new StreamReader(path))
using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
{
records = csv.GetRecords<AccCsv>().ToList();
}
return records;
}
However, when I run it I run into an error that says "Header with name IdNumber[0] was not found" (for all headers). I do have headers in my excel doc. Does anyone who has used CSVhelper know what my error could be Thanks
Snap of my data: sample data