Introduction:
Here I will explain how to Import excel data into datatable or dataset in ASP.NET C#, or Import data from excel to gridview in asp.net using OLEDB in C#
The below code in your aspx page
Here I will explain how to Import excel data into datatable or dataset in ASP.NET C#, or Import data from excel to gridview in asp.net using OLEDB in C#
The below code in your aspx page
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Read and Display Data From an Excel File (.xsl or .xlsx) in
ASP.NET</title>
</head>
<body>
<form id="form1"
runat="server">
<div>
<b>Please Select Excel File: </b>
<asp:FileUpload ID="fileuploadExcel"
runat="server"
/>
<asp:Button ID="btnImport"
runat="server"
Text="Import
Data" OnClick="btnImport_Click" />
<br />
<asp:Label ID="lblMessage"
runat="server"
Visible="False"
Font-Bold="True"
ForeColor="#009933"></asp:Label><br />
<asp:GridView ID="grvExcelData"
runat="server">
<HeaderStyle BackColor="#df5015" Font-Bold="true" ForeColor="White" />
</asp:GridView>
</div>
</form>
</body>
</html>