Skip to main content
*Telega Megaimport*

Framework for parsing CSV, XSL, Google Spreadsheets into Django.


Install package with `pip install telega_megaimport`


Add 'telega_megaimport' to your project's INSTALLED_APPS

To create new parser, use ./manage.py create_parser command
Specify --appdir (directory of app, where parser should be created) and --filename (name of parser)


Inside new parser, declare cells as they go in parsed document (exact order matters!)


Every cell has next args:
- required (boolean, if cell is required for row to work correctly)
- default (arbitraty, if cell has some default value)
Available cell types:
- EmptyColumn (for cells you want to skip)
- StringColumn (for string-containing cells; use arg 'strip' (boolean) to turn on/off strip on parse)
- IntegerColumn
- FloatColumn
- BooleanColumn (will recognize ['yes', 'y', '+', '1', 'true'] as True, ['no', 'n', '-', '0', 'false'] as False)
- ModelColumn (queryset should be declared, lookup_arg by default = 'pk', but can be changed. Returns model (one and only one!) responding by lookup)
- ModelTypeColumn (app_label should be declared if model is ambigious)
- StatusColumn (list or tuple of `parse_ready_statuses` shpuld be declared. Row will be parsed only if all StatusColumns are parse-ready)

***

In newly created parser:
- Override method row(values) to process result of row-parsing
- Override method *attr_name*_handler to prosess result of single cell parsing

***

To run new parser, use ./manage.py <parser_name> [way_to_file]
Next options are supported:
--header - Is there header in file? (default - True)
--sheet - specify .xls sheet name. Will use first one if nothing specified
--progress - set 'True' to use progressbar. Default - False. If True, progressbar module is required
--failfast - set 'True' to stop parsing on first error
--dryrun - set 'True' to perform parsing without commiting data into database
--savestats - set 'True' to collect after-parse statistics into file
--google_spreadsheet - set 'True' if you are parsing google-spreadsheet directly (gspread module required)

Requirements:
- Django >= 1.7
- xlrd (for .xls parse)
- gspread (Optional; for parsing Spreadsheets)
- progressbar (Optional; for ProgressBar generation)

To Be Done:
- Improved test coverage
- Better documentation

Release files for telega-megaimport 0.7.2

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

Built distribution (wheel)

Table of built distributions (wheels) for telega-megaimport 0.7.2
File Interpreter ABI Platform
telega_megaimport-0.7.2-py2-none-any.whl Python 2 none any Details

Release files / telega_megaimport-0.7.2-py2-none-any.whl

Download URL telega_megaimport-0.7.2-py2-none-any.whl
Size 16.2 kB
Tags Python 2
SHA-256 checksum
How to use checksums
49721393130c6d51e873c2500937dc27ace241b955f73b452aafaa1af463083f
BLAKE2b-256 checksum
How to use checksums
2943e6e6ccbc819db237306174c84ee520e3cd0ec95b181cfabe3688aaeb6214
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.7.2 This release

1 release file

0.7.1

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.9

2 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5

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