Read an Excel File with ADO.NET
Problem
You want to retrieve or insert data in a Microsoft Excel document using ADO.NET.
Solution
Use the ODBC provider in conjunction with the Microsoft Excel ODBC Driver.
Discussion
There’s no managed provider or OLE DB provider for Excel. However, you can use the Microsoft Excel ODBC driver, which is installed by default with Excel, in conjunction with the ODBC .NET provider. The ODBC .NET provider is included with the .NET Framework 1.1 (and Visual Studio .NET 2003). If you are using .NET Framework 1.0, you can download the ODBC .NET provider as an add-on from the MSDN site at http://msdn.microsoft.com/library/default.asp?url=/downloads/list/netdevframework.asp.
In your connection string, you’ll need to specify the ...
Get Microsoft® Visual Basic® .NET Programmer's Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.