RubyPDF Blog .NET,Open Source ExcelReader can Read Excel files in pure C# without interop.

ExcelReader can Read Excel files in pure C# without interop.

One of my customers ask me to Convert Excel to XML and save the data to database on website, but his website does not support Ms Excel. I have to look for another solution, on CodeProject, I got ExcelReader.

Sample Image - ExcelReader.png


This library is built based on the following documents, thanks to their authors:

Record structures in BIFF8/BIFF8X format are considered.

What it can do?

  • It can read read worksheets in a workbook and read cells in a worksheet.
  • It can read cell content (text, number, datetime, or error) and cell format (font, alignment, linestyle, background, etc.).
  • It can read pictures in the file, get information of image size, position, data, and format.

Using the code

  1. Open file:
    Stream fileStream = File.OpenRead(file);
    Workbook book = new Workbook();
    Worksheet sheet = book.Worksheets[0];
  2. Read cell:
    int row = 1;
    int col = 0;
    string ID = sheet.Cells[row, col].StringValue;
    Picture pic = sheet.ExtractPicture(row, col);

1 thought on “ExcelReader can Read Excel files in pure C# without interop.”

  1. Hi
    Thanks for this code!
    one help required as i want to read cell format , fore color , back color , and font style (size , bold , italic etc..) but was not able to get it.
    even color palette is not giving right color.
    Please let me know if you have solution for this


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.