Common function when working with excel.
Project description
Django Excel Tools
Common function when working with excel.
Installations
Install django-excel-tools
pip install django-excel-tools
Usage
Class declaration
from django_excel_tools import serializers class OrderExcelSerializer(serializers.ExcelSerializers): REGION_CHOICES = ('Central', 'North', 'East', 'West', 'South') product_name = serializers.CharField(max_length=100, verbose_name='Product Name') quantity = serializers.IntegerField(verbose_name='Quantity', blank=True, default=0) price = serializers.IntegerField(verbose_name='Price') region = serializers.CharField(max_length=10, verbose_name='Region', choices=REGION_CHOICES) transaction_date = serializers.DateField(date_format='%Y-%m-%d', date_format_verbose='YYYY-MM-DD', verbose_name='Transaction Date') class Meta: start_index = 1 fields = ('product_name', 'quantity', 'price', 'region', 'transaction_date')
Class initialization
from openpyxl import load_workbook def import_order(): workbook = load_workbook(file) # Create workbook from file. Used openpyxl worksheet = workbook.worksheets[0] serializer = OrderExcelSerializer(worksheet=worksheet, **kwargs)
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.1.0 (2017-08-22)
- First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size django_excel_tools-0.0.11.tar.gz (16.8 kB) | File type Source | Python version None | Upload date | Hashes View |
Close
Hashes for django_excel_tools-0.0.11.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29ee29b8ce58874227ae547c32fc92081a18b819bc5b4a25d3534bf93dbc7e0d |
|
MD5 | 65e20ff286d673e5fbd70bca8efe47f3 |
|
BLAKE2-256 | 16071a86c2336dc3268a6a0c04f5a31b2f82c05f702e5c2d6d1f0185c78c453f |