reading excel file in .net

hi guys, what's the easiest free .net library to read excel files ? any help is greatly appreciated
nick chanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
The easiest "free" library would be either the Interops libraries, or using an OLEDB connection to open the spreadsheet.

Interops essentially allows you to automate Excel, which you most likely do not want to do (given that you're on a web platform).

An OLDEB connection is fairly straight forward. Here's the connection string I use:

Provider=" & provider & ";Data Source=" & strFilePath & ";Extended Properties=""Excel 12.0 Xml;HDR=YES;IMEX=1"""

Where provider = Microsoft.ACE.OLEDB.12.0 and strFilePath = the full path to my Excel file.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dim connStr As String = String.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='{0}';Extended Properties='Excel 12.0 Xml;HDR=YES'", filePath)
        Dim dt As DataTable = New DataTable
Dim da As OleDbDataAdapter
        Dim ds As New DataSet
            Using conn = New System.Data.OleDb.OleDbConnection(connStr)
                da = New System.Data.OleDb.OleDbDataAdapter("select * from [Sheet1]", conn)
            End Using
            Return ds.Tables(0)
        Catch ex As Exception
            Return Nothing
        End Try

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.