Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tomaspaul opened this issue May 27, 2020 · 1 comment
Open

Comments

@tomaspaul
Copy link

tomaspaul commented May 27, 2020

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.

@tomaspaul
Copy link
Author

This package solved my issue ExcelDataReader. I can read the file without issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant