Solved

create a xls file download without physical file

Posted on 2007-03-30
3
161 Views
Last Modified: 2013-11-19
morning,

I am trying to export some info from my database by creating a downloadable xls file.
i know how to build this using comma delimited (although any tips or pointers would be beneficial) but i don't want to create a physical file on the server for the download.

I have used this is the past but can't remember how to do this, ideally i want to create the file in memory and offer as a save for the user

Cheers
0
Comment
Question by:bhendrick
3 Comments
 
LVL 5

Accepted Solution

by:
mihaimm earned 250 total points
ID: 18839778
You need to set the content-type header of the http response to the proper mime-type of csv (text/csv). By default anything served should be text/html. If you set it to somthing else (like text/csv) the browser should ask the user what to do with it. If you want Excel to be selected you can set it to application/vnd.ms-excel (but that would not be entierly proper).

So... just write... whatever language you write in order to output instead of HTML a csv format and then set the content-type header (this depends a lot on the language/server you use).
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now