문제

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.

도움이 되었습니까?

해결책

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

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top