Search code examples
c#linq-to-excel

How to enumerate an excel file using http://code.google.com/p/linqtoexcel/ in c#


Basically what I need is the contents of an excel file (non blank cells) copied in a structure like IEnumerable<IEnumerable<string>> contents;
The first IEnumerable would be for rows and the second one for columns.
What I've already got working is loading the file using:

var excel = new ExcelQueryFactory("file.xls");

Thanks in advance guys.


Solution

  • The answer was:

    var excel = new ExcelQueryFactory("file.xls");
    var result = excel.WorksheetNoHeader().ToList().Select(x => x.Select(y => y.ToString()).AsEnumerable());
    

    Thanks for the help provided.