-1

I am trying to get data from an excel file to parse to a table in my database. Basically I am trying to read an excel file and copy all the data to a database.

I tried some different methods but did not succeed. I mainly tried to use Reading Excel files from C#

Can someone help me with this.

I am using windows 7 64bit.

Community
  • 1
  • 1
Mark Fenech
  • 1,358
  • 6
  • 26
  • 36
  • 2
    Exactly what error are you getting? 'Did not succeed' is not specific enough for us to assist – Nick.Mc Mar 04 '14 at 08:12

2 Answers2

1

Use .NET libraries for excel, they are generally easier to use, and doesn't require excel installed on target machine.

NPOI for .xls (Excel 2003 and lower), and EPPlus for xslx (2007+)

Antonio Bakula
  • 20,445
  • 6
  • 75
  • 102
-1

Project -> Add Reference -> LATEST Microsoft.Office.Interop.Excel
And then you have this example on how to access the data in a workbook:
Reading data from excel 2010 using Microsoft.Office.Interop.Excel

I hope this is your solution.

Community
  • 1
  • 1
ASA
  • 1,911
  • 3
  • 20
  • 37
  • Interop is really crap. It looks promising, but it's so crappy (usabillity, ease of development, speed!) that you are better off without it. And there is mostly no use-case which requires Interop for excel, something like epplus can do nearly all important things. – Christian Sauer Mar 04 '14 at 08:42