Can anyone advise me if this is possible to do please. I have an Excel spreadsheet and I want to retrieve details from it and display it on an asp page.
Excel has an option to save to XML and save to CSV, if you save to XML you can parse through the document loking for the data you want by using the MSXML objects. If you save it as comma seperated values then you can parse through the file using standard string manipulation functions like InStr, Mid, etc
-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
This space has nothing in it, it's all ni your imagination
You can also retrieve data using ado and select data from a named range(which acts in the same way as a table in a db)
here is some code which I got from somehere
Andy
' This is all standard ADO except for the connection string.
' You can also use a DSN instead, but so it'll run out of the
' box on your machine I'm using the string instead.
Set cnnExcel = Server.CreateObject("ADODB.Connection"
cnnExcel.Open "DBQ=" & Server.MapPath("adotest.xls" & ";" & _
"DRIVER={Microsoft Excel Driver (*.xls)};"
' Same as any other data source.
' FYI: myrange1 is my named range in the Excel file
Set rstExcel = Server.CreateObject("ADODB.Recordset"
rstExcel.Open "SELECT * FROM myrange1;", cnnExcel, _
adOpenStatic, adLockPessimistic
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.