{ "info": { "author": "Ivan Gromov", "author_email": "summer.is.gone@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Natural Language :: Russian", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "Import your data from \\*.xls files\n==================================\n\n\nInstallation\n-------------\n\n\nPackage installed as usually, with command\n\n pip install xlsimport\n\npackage requires ``xlrd`` and ``dateutils``.\n\n\nUsage\n-----\n\nXlsimport provide only API for now, no demo nor default setup. But it's simple to start using it.\n\nFirst, you need to create descendant of ``xlsimport.models.Format`` class, for example::\n\n class SubjectFormat(Format):\n cells = (\n {'name': 'Name', 'parsers': (TextCellToStringParser,)},\n {'name': 'Hours', 'parsers': (TextCellToIntParser, NumberCellToIntParser,)},\n {'name': 'Short name', 'parsers': (TextCellToStringParser,)},\n )\n\n def to_python(self, data_row):\n return {\n 'name': data_row[0],\n 'short_name': re.sub(r'[0-9-]+', '', data_row[2]),\n 'hours': data_row[1],\n }\n\n\nIn this code ``Name`` column may contains only text cells and they are represented as strings.\nSecond column ``Hours`` may contains text cells or number cells. They are represented as integers. Note that parsers\napplied with respect to order.\n\nIf you want to skip column, give ``parsers`` the value ``xlsimport.models.dummy_parsers``.\nIf cell must be empty there is ``blank_parsers`` value for that case.\n\nNext you should make class that knows how to handle data (craate or update records).\nYou also might want to place it into class like Django command.\n\nHere's my example::\n\n ...\n\n class Command(BaseCommand):\n\n ...\n\n def handle(self, *args, **options):\n source_filename = args[0]\n source_file = open(source_filename, 'r')\n descriptor, name = tempfile.mkstemp()\n os.fdopen(descriptor, 'wb').write(source_file.read())\n doc = xlrd.open_workbook(name, formatting_info=True)\n format_doc = SubjectFormat(doc)\n\n for index, parsed_row in enumerate(format_doc):\n process_row(index, parsed_row)\n\n``process_row`` here is a function that takes dictionary from ``to_python`` method above.\n\nTip. I created a `gist `_ with nice example of linux ``dialog`` usage.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/summerisgone/xlsimport", "keywords": "xls xlrd import schema", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "xlsimport", "package_url": "https://pypi.org/project/xlsimport/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/xlsimport/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/summerisgone/xlsimport" }, "release_url": "https://pypi.org/project/xlsimport/0.1/", "requires_dist": null, "requires_python": null, "summary": "Builton top of xlrd, package provides set of cell parsers that make your import easier.", "version": "0.1" }, "last_serial": 801837, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "44e893ac6f9f3698cf975cd67fa67f67", "sha256": "b61afc42f31b0c667f640fff92dcbd7119af2e255bfe3fa0a4e2f1085da1be5f" }, "downloads": -1, "filename": "xlsimport-0.1.tar.gz", "has_sig": false, "md5_digest": "44e893ac6f9f3698cf975cd67fa67f67", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4645, "upload_time": "2013-03-18T19:14:36", "url": "https://files.pythonhosted.org/packages/4a/08/a1733df16b3ecae690a72eae02d4cb0fb31a6c14fbabb373861b8a1a0e48/xlsimport-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "44e893ac6f9f3698cf975cd67fa67f67", "sha256": "b61afc42f31b0c667f640fff92dcbd7119af2e255bfe3fa0a4e2f1085da1be5f" }, "downloads": -1, "filename": "xlsimport-0.1.tar.gz", "has_sig": false, "md5_digest": "44e893ac6f9f3698cf975cd67fa67f67", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4645, "upload_time": "2013-03-18T19:14:36", "url": "https://files.pythonhosted.org/packages/4a/08/a1733df16b3ecae690a72eae02d4cb0fb31a6c14fbabb373861b8a1a0e48/xlsimport-0.1.tar.gz" } ] }