I'm trying to build functionality for users to download a pre-
populated Excel spreadsheet from my web server using xlrd and xlwt.
The server does not have MS Excel installed on it, which I assume is
OK. I have tried a few examples found in previous posts, however
cannot get it to work. When the link is clicked an empy file Excel is
downloaded.

from xlrd import open_workbook
from xlwt import easyxf
from xlutils.copy import copy

@expose(content_type="application/ms-excel")
def export(self, *args, **kw):
    rb = open_workbook(report.xls', formatting_info=True)
    wb = copy(rb)
    response.content_type = 'application/ms-excel'
    response.headers["Content-Disposition"] =
"attachment;filename=report.xls"
    wb.save('report.xls')
    return 'report.xls'

Any assistance would be greatly appreciated.
Thanks,
Michael

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to