Project Description
 Excel Reader simplified! Using OpenXML SDK 2.5 (Production Ready)

Read from Excel spreadsheet easily!

In order to use this ExcelReader library kindly please download OpenXML SDK 2.5.

to use very simple, please follow the following example:

using ExcelReader;
using ExcelReader.ModelHelper;

// imagine Model1 class is the spreadsheet header, and each properties inside it are the column header
// then you will need to map each property with ColumnMapper(string), this string represent the actual
// column in the spreadsheet.
class Model1
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public int Age { get; set; }

class Main()
    const string FilePath = @"C:\Sandbox\ExcelReader\xlsx\Book1.xlsx";
    var xlsxFile = new FileStream(FilePath, FileMode.Open, FileAccess.Read);
    var model1 = new Model1();
    var reader = new ExcelReader.Reader(xlsxFile);
    //we are indicating that we are going to pickup data from Row number 2
    var rows = reader.GetWorksheet(model1, "Sheet1", 2, 0); 
    var records = rows.Cast<Model1>();
    var filtered = records.Where(p => p.LastName.Contains("Kamal"));

GetWorksheet will return all the rows in List<object>, we can cast this to respective class, from there we can use LINQ to query the data in the list.

Excel Reader Supports Multiple Data Type!!
Currently still in beta phase, I am still going to run some test with the code. But glad to announce that we supports DateTime column using our reader! 

I am going to work on creating simple worksheet based on Model!!! Watch this space for new announcement...

Anyone can email me if you guys want to contribute.

Last edited Jul 23, 2013 at 12:32 AM by alfaruq, version 14