I am used to creating a spreadsheet in the following way:
wbk = xlwt.Workbook() earnings_tab = wbk.add_sheet(\'EARNINGS\') wbk.save(filepath)
this is what i use in Django:
response = HttpResponse(content_type='application/vnd.ms-excel') response['Content-Disposition'] = 'attachment; filename=file.xls' book.save(response) return response