Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieving details from an Excel spreadsheet

Status
Not open for further replies.

SonJ

Programmer
Oct 24, 2002
166
GB
Hi there,

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.

SonD
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top