hai,
try this
first insert a file upload control
create a folder in root as "SomeFolderName" and save the excel file with time and filename
create a query to fetch the details from excel and save it in datatable "dt"
you can use the getExcelTable function default..jus u need to change the connection name
<pre lang="vb">
Dim filename As String = Path.GetFileName(FileUpload.FileName)
filepath = "\SomeFolderName\" & Now.Date().ToString("Mdy") & "_" & filename
FileUpload.SaveAs(Server.MapPath("~/") & filepath)
strsql = "select [Col1name]," & vbCrLf & _
"[Col2name] from [Sheetname$]" & vbCrLf & _</pre>
dim dt as Datatable= objdb.getExcelTable(strsql, Server.MapPath("~/") & filepath)
Public Function getExcelTable(ByVal sqlQry As String, ByVal strPath As String) As DataTable
Try
Dim ocmd As New OleDbCommand
Dim oadp As OleDbDataAdapter
Dim con1 As OleDb.OleDbConnection = New OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;" & _
"data source=" & strPath & ";Extended Properties=Excel 8.0;")
con1 = New OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;" & _
"data source=" & strPath & ";Extended Properties=Excel 8.0;")
Dim tb As New DataTable
ocmd = New OleDbCommand(sqlQry, con1)
oadp = New OleDbDataAdapter(ocmd)
tb.Clear()
tb.Rows.Clear()
tb.Columns.Clear()
oadp.Fill(tb)
Return tb
Catch ex As Exception
Throw (ex)
End Try
End Function
for downloading the excel u can simple use hyperlink