Here you will learn how to read data from excel file and upload it in your database. We will be using Microsoft Office  Interop Excel assembly for reading excel file.Just follow these steps one by one :

Step 1: Create a table in Sql Server as shown below :

Step 2: Right Click on Project Name and select Manage Nuget Packages as shown below :

Step 3: Search for Microsoft Office Interop Excel and Install it as shown below:

Step 4: Create a Model for your Database table that you have created earlier as shown below :

Step 5: Create a View and Add a Form for uploading Excel File as shown below:

Step 6: Create a Controller Action and follow these steps in order to read your uploaded excel file :

Excel File:

Database Table:


Congrats You have successfully read data from excel file.

Learn how to deploy ASP.NET MVC application on local IIS Serve.