views:

109

answers:

6

What is the best way/library to read Excel 2003 and 2007 files using C#? I need to do some heavy parsing.

+1  A: 

You can use the MS Office interop assemblies (see here) to access Excel files from .NET applications.

TLiebe
A: 

There are a number of 3rd party tools you can use. I would avoid using the Interop libraries as they can be pretty slow. I have used Aspose.Cells before and it works pretty well. It does cost some money though.

Ocelot20
+1  A: 

Do you need to parse the file, or deal with the contents?

For parsing the file, you'd better hope it's in Open Office XML format, because the previous binary version is not documented at all.

If you just need to deal with the contents, use the Office Interop libraries.

Randolpho
+1  A: 

I would start by trying to use ADO.NET. If that doesn't work, I used xlsio by Syncfusion.

Anthony
+1  A: 

If the data is in some kind of table format I'd suggest to try using OleDbConnection and treating the Excel sheet as another data connection. Otherwise Interop is ok if it's not on a server or anything like that.

ho1
+1  A: 

You can try SmartXLS for .Net,it support most features of excel(cell formatting,Charts,formulas,pivot tables etc),and can read/write both the excel97-2003 xls format and the excel2007 openxml format.

liya