Frage

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.

War es hilfreich?

Lösung

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+)

Andere Tipps

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top