You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reading file returns only first record and only one property value #182
Hi, I have an issue reading the attached file. The records variable has only one record even though there are 100+ records in the Excel file. Report.xlsx. I had to change the extension from xls to xlsx (xls is not supported to upload here). In fact it is old version of Excel (2003).
I use this code to read the file:
var excel = new ExcelQueryFactory(@"C:\Report.xls");
var records = (from c in excel.Worksheet<ReportRecord>("Prague Management Report")
select c).ToList();
I have this data class defined:
public class ReportRecord
{
public string DEPARTMENT { get; set;}
public string SAMPLE_ID { get; set; }
public string PRODUCT { get; set; }
public string CUSTOMER { get; set; }
public string TEST_CODE { get; set; }
public string TEST_DESC { get; set; }
public DateTime DUE_DATE { get; set; }
public string RESULT_STATUS { get; set; }
public string Spec { get; set; }
}
PS: And my latest findings is that the records are all loaded when the Excel file is open in Excel. I do not understand this behavior. Thank you for any feedback.
Activity
tomaspaul commentedon Jun 1, 2020
This package solved my issue ExcelDataReader. I can read the file without issues.