Skip to main content

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')

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-excel-response-1.0.tar.gz (2.4 kB view details)

Uploaded Source

File details

Details for the file django-excel-response-1.0.tar.gz.

File metadata

File hashes

Hashes for django-excel-response-1.0.tar.gz
Algorithm Hash digest
SHA256 b708184ee1c93ac1769e72c49bae5666b9ffce0892daa0b54c7cbec98e1c6014
MD5 09001aa9c8b6dadbe6111e902adbba32
BLAKE2b-256 3b88ed54fd80c752df475fbb84402fbbcec9e0cdbcf5a4c3051e9809f5b18630

See more details on using hashes here.

Release history Release notifications | RSS feed

2.0.5

1 file

2.0.4

1 file

2.0.3

1 file

2.0.2

1 file

2.0.1

2 files

2.0.0

2 files

This release

1.0 This release

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page