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!

Excel and ASP - One file but 2 spreadsheets

Status
Not open for further replies.

SonJ

Programmer
Oct 24, 2002
166
GB
Hi there,

This problem has been bugging me for a while.

Just so you know, I am working with ASP, SQL Server 2000 and Microsoft Excel.

This is what I need to do: I have two sets of information, one for EventA and one for EventB. Both sets of information are held in a table in the database. I need to download all of this information into an Excel file (EVENTS.xls). The hitch is that they need to be downloaded into 2 separate spreadsheets within the same file ie one labelled EventA and the other labelled EventB .

Does anyone know if this is possible to do from an asp page?

My code to create the Excel file is as follows:

Response.AddHeader "content-disposition","attachment;filename=EVENTS.xls;"
Response.ContentType="application/vnd.ms-excel"

I just don't know how to create the separate worksheets!

Any help/ references/ tips would be much appreciated.

Thanks in advance.
 
I have used the following to manage Excel data, adding additional worksheets etc....

Set xlApp = CreateObject("Excel.Application")
set xlWb = xlApp.Workbooks.Open("Path\toxlsfile")
Set xlWs = xlWb.Worksheets("Sheet1")
xlWs.Range("A1").Value = "somedata"
xlWb.Save
xlWb.Close
xlApp.Quit
set xlApp=nothing
set xlWb=nothing
set xlWs=nothing

Hope that helps

JP

_______________________________________________
OutsideIntranets.com
Stop wasting time, get to work
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top