1

I'm using ChoETL in an MVC project in order to read a csv file and load data into a DataTable. I configured the reader to ignore the duplicates and empty lines but this is not applied

DataTable csvFileAsDataTable;
using (var reader = new ChoCSVReader<TItem>(filePath)
    .Configure(c => c.IgnoreDuplicateFields = true)
    .Configure(c => c.IgnoreEmptyLine = true)
    .WithFirstLineHeader())
{
        csvFileAsDataTable = reader.AsDataTable();
}

Using the data here, I expected to have only one single record not all 3 of them.

Can someone tel me what I'm missing here?

1 Answers1

1

There was no problem with the implementation, it was all about understanding the behavior of ChoETL. In fact, IgnoreEmptyLine will only consider a line empty if it's really empty (not even having delimiter). Regarding the second point which was about duplicate fields. This was a confusing between duplicate fields and rows.