Utility to ease reading data from tabular data files
Project description
==========
Tab Import
==========
Tab Import is a Python utility to ease imports of tabular data from CSV, ODF,
XLS or XLSX files.
Some formats require an external Python library:
* ODF: ooolib
* XLS/XLSX: xlrd
This library is meant to be used inside a Django project context.
Usage::
#!/usr/bin/env python
import tabimport
smart_file = tabimport.FileFactory(file_path)
for data_line in smart_file:
do_something_with(data_line['header'])
Import helper
=============
To use the Django import helper in your Django project, follow the steps below.
1. Add 'tabimport' into your INSTALLED_APPS setting.
2. Include the urls of tabimport into your urls::
url(r'^data-import/', include('tabimport.urls')),
3. In any of your models for which you'd like to enable data import, set a
class variable like this: ``support_tabimport = True``.
4. You can then link to the tabimport utility from one of your templates by
reversing a url with ``tabimport``::
<a href="{% url 'tabimport' %}">Import utility</a>
Alternatively, your models can include a class method which will receive the
imported data as a dictionary just before they are used to create a new
instance. This allows you to handle special cases in imported data::
@classmethod
def prepare_import(cls, values):
return values
Tab Import
==========
Tab Import is a Python utility to ease imports of tabular data from CSV, ODF,
XLS or XLSX files.
Some formats require an external Python library:
* ODF: ooolib
* XLS/XLSX: xlrd
This library is meant to be used inside a Django project context.
Usage::
#!/usr/bin/env python
import tabimport
smart_file = tabimport.FileFactory(file_path)
for data_line in smart_file:
do_something_with(data_line['header'])
Import helper
=============
To use the Django import helper in your Django project, follow the steps below.
1. Add 'tabimport' into your INSTALLED_APPS setting.
2. Include the urls of tabimport into your urls::
url(r'^data-import/', include('tabimport.urls')),
3. In any of your models for which you'd like to enable data import, set a
class variable like this: ``support_tabimport = True``.
4. You can then link to the tabimport utility from one of your templates by
reversing a url with ``tabimport``::
<a href="{% url 'tabimport' %}">Import utility</a>
Alternatively, your models can include a class method which will receive the
imported data as a dictionary just before they are used to create a new
instance. This allows you to handle special cases in imported data::
@classmethod
def prepare_import(cls, values):
return values
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.
Source Distribution
TabImport-0.3.3.tar.gz
(8.2 kB
view details)
File details
Details for the file TabImport-0.3.3.tar.gz
.
File metadata
- Download URL: TabImport-0.3.3.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ec48512d3bc3c8b26b25cfad2460c62cffa512a4162d647a370bf8330a7cc34 |
|
MD5 | 3f36d4f2379c1814a54623b1f2de4054 |
|
BLAKE2b-256 | 70d9883ec503752c80bc568544400524bbcb49a75868983ca508708a47b05fd9 |