skip to navigation
skip to content

Not Logged In

django-excel-response 1.0

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. http://djangosnippets.org/snippets/1151/

This is http://djangosnippets.org/snippets/1151/ uploaded to pypi. Author is Tarken.

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.

Installation

pip install django-excel-response xlwt

Usage

from excel_response import ExcelResponse

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

or:

from excel_response import ExcelResponse

def excelview(request):
    data = [
        ['Column 1', 'Column 2'],
        [1,2]
        [23,67]
    ]
    return ExcelResponse(data, 'my_data')
 
File Type Py Version Uploaded on Size
django-excel-response-1.0.tar.gz (md5) Source 2010-09-13 2KB
  • Downloads (All Versions):
  • 26 downloads in the last day
  • 130 downloads in the last week
  • 424 downloads in the last month