Skip to content

Reading file returns only first record and only one property value #182

@tomaspaul

Description

@tomaspaul

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions