1

What's the best tool to import an excel spreadsheet in C# these days? I'm currently using Interop.Excel.dll.

sean
  • 11,164
  • 8
  • 48
  • 56

1 Answers1

1

You can use the Jet OLEDB Provider:

connection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
           "Data Source=c:\somepath\mySpreadsheet.xls;" & _
           "Extended Properties=""Excel 8.0;HDR=Yes""" 

Where "HDR=Yes" means that there is a header row in the cell range (or named range), so the provider will not include the first row of the selection into the recordset.

Ref: how to use ADO to read and write data in Excel workbooks

See also:

Community
  • 1
  • 1
Mitch Wheat
  • 295,962
  • 43
  • 465
  • 541
  • I have just found a funny using Jet: My column headings are dates, and these get transformed into arbitrary column names like 'F1', 'F2', etc. I'll comment again if I find a solution. – ProfK Apr 12 '10 at 13:48