Skip to main content

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

If you require additional columns with export_selected use this snippet instead:

from xlsxdocument import create_export_selected

class AttendanceAdmin(...):
    actions = [
        create_export_selected(
            additional=[
                # ... see above
            ]
        )
    ]

Release files for xlsxdocument 1.3.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xlsxdocument 1.3.10
File Size Uploaded
xlsxdocument-1.3.10.tar.gz 3.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xlsxdocument 1.3.10
File Interpreter ABI Platform
xlsxdocument-1.3.10-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 7.9 kB

Release files / xlsxdocument-1.3.10.tar.gz

Download URL xlsxdocument-1.3.10.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f09471b18cea78b0e2c4fd84e21f3dcd95a6ca7ae3815395e17517467ae89122
BLAKE2b-256 checksum
How to use checksums
c6329ac4caeaf324ba6d75e7b2e06813c9fbc0882b8b52b2e505cf5d13274944
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Release files / xlsxdocument-1.3.10-py2.py3-none-any.whl

Download URL xlsxdocument-1.3.10-py2.py3-none-any.whl
Size 4.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
e7762f6d643854a054c02d7732b9d9c0df81bfe11e12931323e2d14dafc69034
BLAKE2b-256 checksum
How to use checksums
4fd2f11bab89d2ed37686a8e98cccfca1b72d12b1f15fcc3b0f03db812271c79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Release history Release notifications | RSS feed

This release

1.3.10 This release

2 release files

1.3.9

2 release files

1.3.8

2 release files

1.3.7

2 release files

1.3.6

2 release files

1.3.5

2 release files

1.3.4

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page