Skip to main content

django-excel-response3

This is an overhaul of https://pypi.python.org/pypi/django-excel-response which was originally http://djangosnippets.org/snippets/1151/

  • added class detection for values, and will use the value str(class_value)

  • added support for floats, dollar strings, and comma separated number strings that were broken in other forks

  • refactored the code to resemble an actual class, as opposed to one giant init function

  • removed the performance killing import every time you write a sheet, xlwt is required. If you don’t like it use a CSV writer

  • refactored the CSV writing portion of the code to actually use python’s csv class

  • added width auto adjustment

Usage

from excel_response3 import ExcelResponse

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

or

from excel_response3 import ExcelResponse

def excelview(request):
    data = [
        ['Column 1', 'Column 2'],
        [1,2]
        [23,67]
    ]
    return ExcelResponse(data, 'my_data')

Constructor Kwargs

  • headers - an array containing column headers

  • output_name - maintaining this kwarg, but tries first to use the 2nd arg passed when defining the class

  • force_csv - forcibly respond with csv, defaults to False

  • encoding - defaults to ‘utf8’

  • sheet_name - defaults to ‘Sheet 1’

  • blanks_for_none - replace None values with ’’, defaults to True

  • auto_adjust_width - adjust width of each column automatically, defaults to True

Metadata

Release files for django-excel-response3 1.51

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

Source distribution (sdist)

Source distribution for django-excel-response3 1.51
File Size Uploaded Provenance Actions
django-excel-response3-1.51.tar.gz 3.5 kB Without provenance Details for django-excel-response3-1.51.tar.gz

Release files / django-excel-response3-1.51.tar.gz

Download URL django-excel-response3-1.51.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
295b10d9fcc343c93619e140b4f3be324064ddd99ff8e2deebd68e9f2227c1b5
BLAKE2b-256 checksum
How to use checksums
d20b3370f7165efbeab2d8c480d90cad12bf1a0a80d3b344b68e9a1c76d66ba3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-excel-response3 1.51

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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