I am using LinqToExcel in my .net framework project to read some excel files.
Sometimes I receive a file with a date error, and when I try to convert my ExcelQueryable to a list of rows using excel.Worksheet(worksheetName).ToList(); or foreach (var row in worksheet) { var teste = row; } I get a System.ArgumentException error and I cannot proceed.
Is there some way to ignore the error and deal manually with the error Rows?
My code:
var excel = new ExcelQueryFactory(path);
var worksheetNames = excel.GetWorksheetNames();
var worksheetName = worksheetNames.FirstOrDefault();
var worksheet = excel.Worksheet(worksheetName);
List<Row> itens = excel.Worksheet(worksheetName).ToList();
I expect to convert the ExcelQueryable to a List with no errors
you can use ClosedXML lib.
this is a function to read excel to DataTable
and function itself