How Read and Import Excel Sheet cell by cell and save into Database in ASP.Net

Last Reply on Nov 08, 2016 08:04 AM By dharmendr

Posted on Nov 08, 2016 07:55 AM

I have an requirement where user uploads an excel file in this process data from cell is extracted and then saved in database (excel file won't get saved in our application only data is extracted) our application when reads this file then it must read all cells one by one and while processing it should do three important task:

1- If special character is found in excel cell then that row must be ignored and after process is complete it should display that cell data in gridview.

2- There should be not more than four columns in excel file.

3- If complete row data is already found in database then system should ignore that row

While surfing I found few articles which might help you/me in finding the solution:

http://www.aspsnippets.com/Articles/Export-GridView-Data-to-Excel-using-OpenXml-in-ASPNet.aspx

http://www.aspsnippets.com/Articles/Read-and-Import-Excel-Sheet-into-SQL-Server-Database-in-ASP.Net.aspx

http://www.aspsnippets.com/Articles/Read-and-Import-Excel-Sheet-into-ASP.Net-GridView-Control.aspx

http://www.aspsnippets.com/Articles/Read-and-Import-Excel-Sheet-using-ADO.Net-and-C.aspx

http://www.mikesdotnetting.com/article/297/the-best-way-to-import-data-from-excel-to-sql-server-via-asp-net

 

You are viewing reply posted by: dharmendr on Nov 08, 2016 08:04 AM.
Posted on Nov 08, 2016 08:04 AM

Hi EmadKhan,

You can refer the below article.

Read and Import Excel Sheet into ASP.Net GridView Control

In the above article you are you are getting the datatable in the section "Read Data from First Sheet". Once you will get the data you can loop through each record and achive your task as per your condition.