skip to navigation
skip to content

django-excel-response2 2.0.1

A function extends of Tarken's django-excel-response


A subclass of HttpResponse which will transform a QuerySet, or sequence of sequences, into either an Excel spreadsheet or CSV file formatted for Excel, depending on the amount of data. All of this is done in-memory and on-the-fly, with no disk writes, thanks to the StringIO library.


When using Tarken’s django-excel-response. We find that Chinese is messed code when we open .xls in Mac OS. As discussed in We realize django-excel-response2 Based on Tarken’s django-excel-response to solve this problem By adding a Param named font to set font.

At The Same Time:

  • Fix Bug
    • can’t subtract offset-naive and offset-aware datetimes


pip install django-excel-response2


from excel_response2 import ExcelResponse

def excelview(request):
    objs = SomeModel.objects.all()
    return ExcelResponse(objs)


from excel_response2 import ExcelResponse

def excelview(request):
    data = [
        ['Column 1', 'Column 2'],
        [1, 2],
        [3, 4]
    return ExcelResponse(data, 'my_data', font='name SimSum')


  • font=’name SimSum’
    • Set Font as SimSum(宋体)
  • force_csv=True
    • CSV Format? True for Yes, False for No, Default is False
File Type Py Version Uploaded on Size
django-excel-response2-2.0.1.tar.gz (md5) Source 2015-10-12 3KB
django_excel_response2-2.0.1-py2.7.egg (md5) Python Egg 2.7 2015-10-12 5KB