I prefer to use the Microsoft OpenXML 2.0 SDK for this kind of function. It has a really good interface, and it does not require Office to be installed on a machine reading an .xlsx file, which is good.
I am writing this from my mobile phone, it is so difficult to provide a link, but a Google search should easily find it for you.
Give it a try. I think you will like it.
EDIT
If you need to use .NET 2.0, you can use the JET OleDb option OleDb .
This means that you will do something like this to connect:
OleDbConnection connection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source='" + filename + "';" + "Extended Properties=\"Excel 8.0;HDR=No;IMEX=1;\"";);
Then you can request it, as in the example above:
OleDbDataAdapter objAdapter = new OleDbDataAdapter("select * from [Sheet1$]", connection);
Give it a try! Just note that Jet has a weird decision logic whether the column is numeric or not. See the following SO questions for more information: Problem using OleDbDataAdapter to retrieve data from an Excel worksheet
source share