Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def exportexcel(request):
- from xlwt import Workbook
- wb = Workbook()
- ws = wb.add_sheet('Sheetname')
- ws.write(0, 0, 'Firstname')
- ws.write(0, 1, 'Surname')
- ws.write(1, 0, 'Hans')
- ws.write(1, 1, 'Muster')
- fname = 'testfile.xls'
- response = HttpResponse(mimetype="application/ms-excel")
- response['Content-Disposition'] = 'attachment; filename=%s' % fname
- wb.save(response)
- return response
Add Comment
Please, Sign In to add comment