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

How to Create Excel Files that do not reside on Web Server??

Status
Not open for further replies.

Enya

MIS
Dec 3, 2004
17
0
0
US
I have already generated an Excel file from an ASP page. But this file resides on the web server. I dont want this file to reside on the web server. Can anyone help me with any suggestions??

Thanks in advance.
 
you could do two things. You could

A: attach the excel file to an email and then email it to whomever is requesting it.

example using CDONTS. You might have to modify depending on what email component you have access to:
Code:
dim emObj, xlFileLoc
xlFileLoc = server.mappath("someworksheet.xls")
set emObj = server.createobject("cdonts.newmail")
emObj.From = "you@yourdomain.com"
emObj.To = "towhom@thatdomain.com"
emObj.Subject = "Your Excel file"
emObj.Body = "Here is the excel file that you created!"
emObj.AttachFile xlFileLoc, "someworksheet.xls"
emObj.Send
set emObj = nothing

or

B: (I'm not sure if this will work though)
Do a response.redirect to the actual Excel spreadsheet. Since the Response.Redirect makes the user's browser redirect to the file you specify, there's a chance that the User will be given a prompt to download the Excel file. Again, I'm not sure if this will work or not, but if my understanding of the Response object is correct, theoretically it should.

good luck
 
You can totally create the Excel file as a text string via ASP and then BinaryWrite it to a browser. This way the Excel document isn't really a file at all. You have to create them using XML though or using Response.ContentType (an easier solution) to send the document out in an Excel ContentType. Note that the examples are in Word, but you should be able to translate them to work in Excel too.

For more info try these:

ASP to create Word files and sent them to the client

ASP and XML to create Word Files

ASP using MIME Types to sent files out as MS Word or other

Common MIME Types (reference)
Harold Blackorby
hblackorby@scoreinteractive.com
St. Louis, MO
 
Thanks for all the suggestions.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top