• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 177
  • Last Modified:

create a xls file download without physical file

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
bhendrick
Asked:
bhendrick
1 Solution
 
mihaimmCommented:
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now