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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create queries and export the data to Excel

Status
Not open for further replies.

camillaj

Programmer
Sep 18, 2003
31
AU
I have a database with data relations that I want to export to Excel. I know I can export tables directly from Access etc. till Excel, but this data is not very readable.

I want to make some queries to retrieve certain results, maybe store the result in a tmp table, and then export the result to Excel from an ASP page. In this way I can join the tables as I want and create a more readable excel file.

Does anybody know if this is possible or how I could go about doing it?

Thanks a lot for any response to this :eek:)
 
You can retrieve data from excel and then do what you like with it

Set connObj = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.RecordSet")

connstring = "DRIVER=Microsoft Excel Driver (*.xls);" _
& "DBQ=" & Server.MapPath("yourfile.xls")
connObj.Open connstring

filename = "sheet1" ' excel

sql ="Select * From ["&filename&"$]"

'open xls connection
set rs = connObj.Execute(sql)

do while not rs.EOF
'do somemthing here
rs.Movenext
loop
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top