In this tutorial, I am going to explain you how to read excel file in C# without using Microsoft Office Interop Excel Provider. We will be using NPOI which is .NET version of POI Java project at http://poi.apache.org/. POI is an open source project which can help you read/write xls, doc, ppt files. It has a wide application. I will be using Visual Studio 2013. Below is step by step tutorial.
Creating ASP.NET Empty Application
First step is to create ASP.NET Empty WebForm project.
Go to File → New → Project. A new window will be open as shown below.
Now go to Web → Visual Studio 2012 → select .NET Framework 4.5 → select ASP.NET Empty Web Application and give project name and click on OK.
Now, an asp.net empty project will be created.
Installing NPOI using Nuget
Next step is to install NPOI. Right click on References of application and go to Manage NuGet Packages and after that a new window will open as shown below. Search for NPOI and install it as shown below.
Now add a new webform i.e WebForm1.aspx file to the application. Create a gridview control as shown below.