Skip to main content

Load Excel files into your Django database.

Project description

Minchin.Django.Excel

This is a Django app designed to allow you to push the contents of Excel workbooks to your Django database. I packaged it because while it seems like it should be simple, it involved many more moving pieces (including management commands, templates, template tags, admin pagination, etc.) than I initially thought it should.

Installation

The package is installable via pip:

pip install minchin.django.excel

This will also install all the required dependencies (of which there are many...).

From there, you need to add it to your list of installed apps in your Django settings.py:

# settings.py

INSTALLED_APPS = [
  # first in line
  "related_admin",  # for minchin.django.excel

  # django built-ins
  # others...
  "django.contrib.humanize",
  
   # others...
   "minchin.django.excel",
   "prettyjson",  # for minchin.django.excel
]

# other settings...

Second, ensure that your TEMPLATES setting contains a DjangoTemplates backend whose APP_DIRS options is set to True:

# settings.py

TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "APP_DIRS": True,
        # ...
    }
]

# other settings...

and then run the included database migrations:

python manage.py migrate

Loading Excel Data

Includes is a Django management commands to load the Excel files:

python manage.py load_excel <excel_file.xlxs>

From there, you would likely process the data further within Django.

Django Admin Site

There are also several helpers so that you can see the loaded data on the built-in Django admin site. However, you'll need to register them to your admin site:

# admin.py

from minchin.django.excel.admin import WorkbookAdmin, SheetAdmin, RowAdmin
from minchin.django.excel.models import Workbook, Sheet, Row

admin.site.register(Workbook, WorkbookAdmin)
admin.site.register(Sheet, SheetAdmin)
admin.site.register(Row, RowAdmin)

License

The code is licensed under the MIT license. See attached License.txt

Changelog

Version 1.0.0 -- Dec. 12, 2025

  • initial public release

Contributions

Contributions are welcome, however the scope of the project is intentionally limited. In particular though, there are no tests currently in place, and additions there would be appreciated.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

minchin_django_excel-1.0.0-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file minchin_django_excel-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for minchin_django_excel-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1154f6593a6cec548aa804d599c45bbc216a6b98e871ac442e826a7a29b3e184
MD5 3cf1d91d03dd52c5df7bf153c0b1f747
BLAKE2b-256 f563842a2abda31831d1f731965869a591a607193e387684bb014fbe023a590d

See more details on using hashes here.

Supported by

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