Skip to main content

Posts

Showing posts with the label uploading an excel and importing the data in database

Uploading an Excel and Importing the data in database

This is very common requirement to read the data from uploaded excel and import it in database. Earlier it was a tedious task but not now, thanks to Nuget packages where you get so many utilities to make your life easy. In this post, we will also use Nuget package and perform the task of uploading excel and importing the data in database. There are two steps to perform this, 1. To upload the excel file on server 2. Read the uploaded file and import the data to database Step1: To upload the excel file on server    < asp:FileUpload ID =" excel_upload " runat =" server "/>          if (excel_upload.HasFile)     {         bool upload_file = true ;         string file_upload = Path.GetExtension(excel_upload.FileName.ToString());         if (file_upload.Trim().ToLower() == " .xls " |              file_upload.Trim().ToLower() ...