{ "info": { "author": "Ryosuke Wakaba", "author_email": "wakaba.ryosule@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# excel2dict\n\nexcel2dict support easy loading data from excel files.\n\n## Intalling\n```\npip install excel2dict\n```\n\n## Quick Over View\n\nAssuming below sample data was saved as excel file named Book.xslx.\n\n|foo|bar|\n|--|--|\n|'a'|1|\n|'b'|2|\n\n\nSimply, To convert to JSON format text file with command line.\n\n```\n$ excel2dict Book.xlsx > out.json\n$ less out.json\n[\n {\n \"foo\": 'a',\n \"bar\": 1 \n },\n {\n \"foo\": 'b',\n \"bar\": 2 \n }\n]\n```\n\nAs well, you can do the same thing in python script.\n\n```\n>>> import excel2dict\n>>> excel2dict.to_dict('Book.xlsx')\n[\n {\n \"foo\": 'a',\n \"bar\": 1 \n },\n {\n \"foo\": 'b',\n \"bar\": 2 \n }\n]\n```\n\n## Using Sheet Definition\nAs above example, at simple usage, some data representing dedicated data type(boolean, date, etc) in excel can not be handled usefully.\n\nFor this use case, you use a sheet definition file. if exists, excel2dict load a definition file named `sheet_definition.yaml` from the directory which a target excel file is saved in or optional argument specified to by `-s`.\n\n### sample definition\n```\nsheets:\n- name: Members\n cols: \n - name: member_no\n schema:\n type: int\n - name: name\n schema:\n type: string\n - name: is_active\n schema:\n type: bool\n```\n\n### Label Definition\nNormally, sheet name is named in a business context in which the name may include multibyte character, space, etc. but for handling in script or JSON text file, named only ascii character is useful.\nFor this, you can add `label` definition to the definition.\n\n#### For Sheet\n```\nsheets:\n- name: members\n label: New Members\n```\n\n#### For Column\n```\ncols: \n - name: name\n label: Member's Name\n```\n\n### Data Type Definition\nexcel2dict suppot below data type.\n\n#### int\n```\nschema:\n type: int\n```\n#### str\n```\nschema:\n type: str\n```\n#### bool\n```\nschema:\n type: bool\n```\n#### date\n```\nschema:\n type: date\n```\n#### datetime\n```\nschema:\n type: datetime\n```\n\nFor needing to adjust timezone, specifing offset is avalable.\n```\nschema:\n type: datetime\n offset: 9\n```\nFor example, `2019-07-26T09:00:00` in JST, this setting convert the datetime to `2019-07-26T00:00:00`\n\n## A Bit Odd Function\nFor rare use case, you may need to convert values defined in other sheets as nested structure.\n\nFor example, assuming there were 2 sheets as below, \n\n#### Sheet1\n|User|Access Right|\n|--|--|\n|Scott|Admin|\n|Tom|General|\n\n#### Sheet2\n|Access Right|Read|Write|\n|--|--|--|\n|Admin|O|O|\n|General|O|X|\n\n#### Sheet Definition\nOn Sheet1 setting, specify `type` with `ref` and `sheet` with reference sheet name.\n\n```\nsheets:\n- name: Sheet1\n columns:\n - name: user\n label: User\n schema:\n type: int\n - name: access_right\n label: Access Right\n schema:\n type: ref\n sheet: Sheet2\n- name: Sheet2\n columns:\n - name: ref_name\n label: Access Right\n```\n\n#### Output\nYou can get an output like below format defining as `ref` type.\n```\n[\n {\n \"user\": \"Scott\",\n \"access_right\": {\n \"Read\": \"O\",\n \"Write\": \"O\"\n }\n },\n {\n \"user\": \"Tom\",\n \"access_right\": {\n \"Read\": \"O\",\n \"Write\": \"X\"\n }\n }\n ]\n```\n\n## How to specify\nRequired setting are type and sheet.\n- type: `ref`\n- sheet: reference sheet name\n\n```\nschema:\n type: ref\n sheet: Sheet2\n```\n\nFor array, specifing `is_array` is avalable.\n```\nschema:\n type: ref\n sheet: Sheet2\n is_array: true \n```\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/rwakaba/excel2dict", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "excel2dict", "package_url": "https://pypi.org/project/excel2dict/", "platform": "", "project_url": "https://pypi.org/project/excel2dict/", "project_urls": { "Homepage": "https://github.com/rwakaba/excel2dict" }, "release_url": "https://pypi.org/project/excel2dict/0.0.2/", "requires_dist": [ "PyYAML", "xlrd" ], "requires_python": "", "summary": "A converting excel file to python data structure package", "version": "0.0.2" }, "last_serial": 5599282, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "2a56e35901f200191e4c427dc2c43389", "sha256": "30aefc4f74b37b6aef3d8d587b50645b46e844647c23879ff000989c473b8a21" }, "downloads": -1, "filename": "excel2dict-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "2a56e35901f200191e4c427dc2c43389", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7569, "upload_time": "2019-07-28T11:33:38", "url": "https://files.pythonhosted.org/packages/9c/e1/eb075bcb7340ae7f2c0d9d5fc611105e70d35a0c58c41f6ad2cb85cff94b/excel2dict-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5a9e71a2506b3655c2502b1116513077", "sha256": "5b190052f4dcc3f06d13f90d3a7d2651baa075abba09e4b521a7647e579684d9" }, "downloads": -1, "filename": "excel2dict-0.0.1.tar.gz", "has_sig": false, "md5_digest": "5a9e71a2506b3655c2502b1116513077", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6198, "upload_time": "2019-07-28T11:33:41", "url": "https://files.pythonhosted.org/packages/78/92/381ff5c977855d8fcf913538886f29cb1f36704082de2bd92207c1b55d0e/excel2dict-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "4589f07d841abb52949abeb00d940bf6", "sha256": "664de22427c0ce1faec1cda91fa876111502344309c04971dc8a80c173c518f9" }, "downloads": -1, "filename": "excel2dict-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "4589f07d841abb52949abeb00d940bf6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7778, "upload_time": "2019-07-29T12:28:35", "url": "https://files.pythonhosted.org/packages/26/75/c4901603b30c9ec1044c919522e9f6b40a03c334235d67ea93b232d60af3/excel2dict-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5618d62fcc01994349a55bad8883d97e", "sha256": "df6ddaf4ebbcb410718eac1847925cba663b32b46153c3888d91ab826abfed1f" }, "downloads": -1, "filename": "excel2dict-0.0.2.tar.gz", "has_sig": false, "md5_digest": "5618d62fcc01994349a55bad8883d97e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6298, "upload_time": "2019-07-29T12:28:36", "url": "https://files.pythonhosted.org/packages/3e/66/13994c5277964c5e5e5c466e204def0ee4fcf3c672fc380ed79b530d5bc7/excel2dict-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4589f07d841abb52949abeb00d940bf6", "sha256": "664de22427c0ce1faec1cda91fa876111502344309c04971dc8a80c173c518f9" }, "downloads": -1, "filename": "excel2dict-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "4589f07d841abb52949abeb00d940bf6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7778, "upload_time": "2019-07-29T12:28:35", "url": "https://files.pythonhosted.org/packages/26/75/c4901603b30c9ec1044c919522e9f6b40a03c334235d67ea93b232d60af3/excel2dict-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5618d62fcc01994349a55bad8883d97e", "sha256": "df6ddaf4ebbcb410718eac1847925cba663b32b46153c3888d91ab826abfed1f" }, "downloads": -1, "filename": "excel2dict-0.0.2.tar.gz", "has_sig": false, "md5_digest": "5618d62fcc01994349a55bad8883d97e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6298, "upload_time": "2019-07-29T12:28:36", "url": "https://files.pythonhosted.org/packages/3e/66/13994c5277964c5e5e5c466e204def0ee4fcf3c672fc380ed79b530d5bc7/excel2dict-0.0.2.tar.gz" } ] }