I have this code to populate datatable from excel file:
for (int rowIndex = cells.FirstRowIndex; rowIndex <= cells.LastRowIndex; rowIndex++) { var values = new List<string>(); foreach (var cell in cells.GetRow(rowIndex)) { values.Add(cell.Value.StringValue); } dataTable.LoadDataRow(values.ToArray(), true); }
I have a problem when the cell is not the same data type as the table.
How to skip a cell that is the wrong data type?
I also know this, but I can't get it to work in my case:
foreach //... { if //if datatype is not right { continue; } }
el ninho
source share