I’m just beginning a project where my system (written in .NET MVC) will have to read Excel data from a specified file, and import into the database (SQL Server 2008).
The NPOI library is already deployed in the system which works pretty well, however I have found it quite difficult to find sample code on the web with regards to collecting data, and importing it.
I was wondering if anyone who has experience with this sort of work could point me in the right direction with regards sample code, tutorials, etc?
Or if anyone can recommend a better alternative to NPOI?
Depending on the layout of your excel file (i.e. if it is tabular) you could use ADO.Net to do it. You can query data from sheets and pull data as if you were querying a true database.
You can start with the connection string: http://www.connectionstrings.com/excel
Then there is a vb.net example over on MSDN, that you could easily convert to C#: http://support.microsoft.com/kb/311731