ASP 101 - Active Server Pages 101 xl_data.aspx
<%@ Page Language="VB" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<script language="VB" runat="server">
	Sub Page_Load(sender as Object, e as EventArgs)
		' Only fill the DataGrid with data from the Excel file on first run
		If Not Page.IsPostBack Then
			Dim myConnectionString As String
			Dim myConnection       As OleDbConnection
			Dim myCommand          As OleDbCommand
			Dim myDataReader       As OleDbDataReader
			' Set our connection string.  Data file is "xl_data.xls" in the
			' current directory.
			myConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" _
				& "Data Source=" & Server.MapPath("xl_data.xls") & ";" _
				& "Extended Properties=Excel 8.0;"
			' Create our connection object using the connection string above.
			myConnection = New OleDbConnection(myConnectionString)
			' Create a Command that selects the data from the Excel file.
			' Note that "TestData" is a named range in the Excel file which
			' you need to set up in advance.  To do so from within Excel
			' simply highlight the data range to use, Insert -> Name -> Define,
			' and type in the name by which you will refer to the region.
			myCommand = New OleDbCommand("SELECT * FROM TestData;", myConnection)
			' Open the connection
			' Use the ExecuteReader method of the Command object to execute
			' our query and return the results via a DataReader
			myDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
			' Specify the DataReader as the source of the data for our DataGrid
			' and then DataBind to display the data in our DataGrid.
			dgExcelData.DataSource = myDataReader
			' Close our DataReader and Connection
		End If
	End Sub
<title>ASP.NET Excel Data Sample</title>
<form runat="server">
<asp:DataGrid id="dgExcelData" runat="server"
	HeaderStyle-Font-Bold = "True"
	CellSpacing = "1"
	CellPadding = "2"
Data above pulled from: <a href="">xl_data.xls</a>
<hr />
Click <a href="">here</a>
to read about and download the source code.