Skip to main content

Easily create XLSX documents with Django

Project description

This is a wrapper for openpyxl which makes creating XLSX documents with the purpose of exporting data less boring:

from xlsxdocument import XLSXDocument

def xlsx_export(request):
    some_data = Bla.objects.all()

    xlsx = XLSXDocument()
    xlsx.table_from_queryset(Bla.objects.all())
    return xlsx.to_response('bla.xlsx')

Adding in additional cells at the end is also possible:

xlsx = XLSXDocument()
xlsx.table_from_queryset(
    Bla.objects.all(),
    additional=[(
        'Full URL',
        lambda instance: 'http://example.com%s' % (
            instance.get_absolute_url(),
        ),
    )],
)

You can also easily add the facility to export rows to Django’s administration interface:

from django.contrib import admin
from django.utils.translation import ugettext_lazy as _

from xlsxdocument import export_selected

from app import models


class AttendanceAdmin(admin.ModelAdmin):
    list_filter = ('event',)
    actions = (export_selected,)


admin.site.register(models.Event)
admin.site.register(models.Attendance, AttendanceAdmin)

Project details


Download files

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

Source Distribution

xlsxdocument-1.1.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

xlsxdocument-1.1.0-py2.py3-none-any.whl (4.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file xlsxdocument-1.1.0.tar.gz.

File metadata

File hashes

Hashes for xlsxdocument-1.1.0.tar.gz
Algorithm Hash digest
SHA256 120505dac06319bac989262507f09ba7615d3878c2cdcd4ce560bbda019a8ebb
MD5 5521e20267c152afc627996c329d7375
BLAKE2b-256 ddaac3c17f26ea5c1bc4f79d92841df3dba2a2dca33a42a199aadbf0a03a264c

See more details on using hashes here.

File details

Details for the file xlsxdocument-1.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for xlsxdocument-1.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 28c1a841ac25c70e4f9387ebef1ddd19638aca59dc6055c9dbb01068f790e513
MD5 8c49132ff24b40bfc9a8718df7cb6d69
BLAKE2b-256 fb6ec45cfb548ffdf4183cfeb8e6d41c46510cccb19c9a3d03003cec2aa15678

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page