I've made a few excel reading ASP pages using ADODB. I can't seem to read this one file one of our customers keeps giving us.
This is the XLS file.
http://www.claydesign.com/experts-exchange/TSIT20041220.zipUpload the file here (unzip it first):
http://www.claydesign.com/experts-exchange/uploadxls.aspI can't see I8 or I10 in this file. I really have no clue why only these two cells don't show up.
Feel free to test the file parser by uploading your own XLS file. It only reads sheet 1.
You can view the uploadxls.asp code by viewing the source. Below is the createtable.asp code:
<%@language=VBScript%>
<%
'Get binary data from form and save file to the server
set objUpload = Server.CreateObject ("Dundas.Upload.2")
objUpload.UseUniqueNames = false
Set objNextFile = objUpload.GetNextFile()
uploadname = objNextFile.FileName
objNextFile.save "C:\Inetpub\webhosting\
www.claydesign.com\experts-exchange\QVCRepository\"
set objNextFile = nothing
Set objUpload = Nothing
'Use ADODB to open the excel file, use the GetRows method to fill the arrRows array
Set cnnExcel = Server.CreateObject("ADODB
.Connectio
n")
cnnExcel.Open "DBQ=" & Server.MapPath("QVCReposit
ory\" & uploadname) & ";DRIVER={Microsoft Excel Driver (*.xls)};"
Set rstExcel = Server.CreateObject("ADODB
.Recordset
")
rstExcel.Open "SELECT * FROM [Sheet1$];", cnnExcel
arrRows = rstExcel.GetRows
rstExcel.Close
set rstExcel = Nothing
cnnExcel.Close
set cnnExcel = Nothing
'Output the excel file to a table
response.Write "<table border=""1"">"
for x=lbound(arrRows,2) to ubound(arrRows,2)
response.Write "<tr>"
for y=lbound(arrRows,1) to ubound(arrRows,1)
response.Write "<td> " & arrRows(y,x) & "</td>"
next
response.Write "</tr>"
next
response.Write "</table><br><a href=""
http://www.claydesign.com/experts-exchange/uploadxls.asp"">
Back</a>"
%>
Thanks for any help!!!
-Coolhand2120
Start Free Trial