Oh, heck...it's actually a piece of cake.
Here's a demo ASP page:
Code:
<%
connstr = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & Server.MapPath ("junk.xls") & ";" _
& "Extended Properties=""Excel 8.0;HDR=Yes"""
Set cat = Server.CreateObject("ADOX.Catalog")
cat.ActiveConnection = connstr
Response.Write "Found " & cat.Tables.count & " tables in that XLS file.<p>"
For tnum = 0 To cat.Tables.count - 1
Set tbl = cat.Tables(tnum)
Response.Write "Table " & tnum & " is named " & tbl.Name & "<br/>" & vbNewLine
Next
%>
Worked like a charm first time. You could even get the column names of all the columns in each table using ADOX. And more.
Since DarkHalf already *HAS* a connection to the spreadsheet, as demoed by the
rstExcel.Open "SELECT * FROM [Sheet1$];", cnnExcel, adOpenStatic, adLockPessimistic
code line, he/she could just do
<%
Set cat = Server.CreateObject("ADOX.Catalog")
Set cat.ActiveConnection cnnExecl
%>
and be ready to go.
*******************
DarkHalf: How come you open that spreadsheet with adOpenStatic and adLockPessimistic??? Your comments said you were *READING* from that spreadsheet, so why are you locking it for *WRITE*???
And adOpenStatic would only be needed if you were going to do random record positioning within the rows of the sheet. And even then, the Excel driver won't support that, so you'd need to also specify a client-side cursor.