I have this csv file :
firstName;lastName;78
fn1;ln1;67
fn2;;56,7
fn3;ln3;23,5
fn4;ln4;16,7
And this class:
[DelimitedRecord(";")]
public partial class Person
{
private string firstName;
[FieldNullValue("default first name")]
private string lastName;
private string age;
public string FirstName
{
get { return firstName; }
set { firstName = value; }
}
public string LastName
{
get { return lastName; }
set { lastName = value; }
}
public string Age
{
get { return age; }
set { age = value; }
}
}
And i use this code to retrieve the data:
ExcelStorage provider = new ExcelStorage(typeof(Person));
provider.FileName = "data.csv";
System.Data.DataTable dataTable = provider.ExtractRecordsAsDT();
And the data table contains this:
dataTable.Rows[0].ItemArray
{object[3]}
[0]: "firstName;lastName;78"
[1]: "default first name"
[2]: {}
dataTable.Rows[1].ItemArray
{object[3]}
[0]: "fn1;ln1;67"
[1]: "default first name"
[2]: {}
dataTable.Rows[2].ItemArray
{object[3]}
[0]: "fn2;;56"
[1]: "7"
[2]: {}
dataTable.Rows[3].ItemArray
{object[3]}
[0]: "fn3;ln3;23"
[1]: "5"
[2]: {}
dataTable.Rows[4].ItemArray
{object[3]}
[0]: "fn4;ln4;16"
[1]: "7"
[2]: {}
I am definitely missing something.
EDIT: I replaced decimal separator from ',' to '.' and i still get the same bad results
Problem solved : FileHelperEngine must be used instead of ExcelStorage