What's the best tool to import an excel spreadsheet in C# these days? I'm currently using Interop.Excel.dll.
Asked
Active
Viewed 383 times
1
-
'Best' depends on your requirements. – Adam Ralph Sep 20 '09 at 15:15
-
Are you just reading the file or moving it into a different structure, such as SQL Server or an xml file? SSIS would work well, as long as you are using 32-bit Windows OS. – James Black Sep 20 '09 at 15:18
1 Answers
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