Solved

create a xls file download without physical file

Posted on 2007-03-30
3
159 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
Read about why website design really matters in today's demanding market.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
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.

760 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

20 Experts available now in Live!

Get 1:1 Help Now