views:

150

answers:

2

Hi,How can i make user to downlaoad a excel from the django app.i HAVE A MODEL WHICH gives the report.Now i want a option from user can download the file in excel form.ANy Solution

+1  A: 

You can output the data as .csv which is easily imported into MS Excel.
http://docs.djangoproject.com/en/dev/howto/outputting-csv/

EDIT
After I wrote that I got curious if there actually was some way to do it directly to excel format and found:
http://www.python-excel.org/
That made me wonder why you didn't google your question before posted it here.....

amoeba
A: 

I'm not sure quite what you're asking. If you're asking how can you generate output that's able to be read into Excel, IMO your best bet is using a CSV (see amoeba's response) as that's pretty generic. There are ways of using true Excel formats as well.

I'm thinking though that perhaps you're asking how you can have a user click a link (or whatever) and have Excel pop up with your data in it? (IOW, you've already generated the output).

I suppose I'd say a few things: 1) It shouldn't be specific to Excel, many users use things like OO.o (thus my CSV suggestion) 2) It's going to vary depending on their browser and how they have it set up. Personally, I don't like pages opening up the "proper application" so I turn all of that off - other people enable it.

geoffjentry