{ "info": { "author": "Masahiro Kasahara", "author_email": "mkasa@cb.k.u-tokyo.ac.jp", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: End Users/Desktop", "Intended Audience :: Science/Research", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Topic :: Scientific/Engineering :: Information Analysis", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Utilities" ], "description": "=========\njson2xlsx\n=========\njson2xlsx is a tool to generate MS-Excel Spreadsheets from JSON files.\n\nInstallation\n------------\nInstall as general python modules. Briefly, do as follows::\n\n $ sudo easy_install json2xlsx\n\nYou can also use pip::\n\n $ sudo pip install json2xlsx\n\nIf you want to install the latest (likely development) version, then do as follows::\n\n $ cd some_temporary_dir\n $ git clone git://github.com/mkasa/json2xlsx.git\n $ cd json2xlsx\n $ python setup.py build\n $ sudo python setup.py install\n\nNote that you may encounter an error while installing pyparsing on which json2xlsx\ndepends. This is probably because pyparsing 1.x runs only on Python 2.x while\npyparsing 2.x runs only on Python 3.x. Currently, json2xlsx declares in the package\nthat pyparsing 1.x is required, which means that Python 3.x users must install\njson2xlsx from GitHub with manual modificatin to setup.py. I do not use Python 3.x\noften, so please let me know a workaround.\n\nSimple Example\n--------------\nLet's begin with a smallest example::\n\n $ cat test.json\n {\"name\": \"John\", \"age\": 30, \"sex\": \"male\"}\n $ cat test.ts\n table { \"name\"; \"age\"; \"sex\"; }\n $ json2xlsx test.ts -j test.json -o output.xlsx\n\nThis will create an Excel Spreadsheet 'output.xlsx' that contains\na table like this:\n\n+-----+-----+-----+\n|name | age | sex |\n+-----+-----+-----+\n|John | 30 | male|\n+-----+-----+-----+\n\nIsn't it super-easy? Here, `test.ts` is a script that defines the table.\nLet's call it *table script*.\n`-j` option specifies an input JSON file. You can specify as many `-j`\nas you wish. `-o` gives the name of the output file::\n\n $ cat test.json\n [{\"name\": \"John\", \"age\": 30,\n \"sex\": \"male\"},\n {\"name\": \"Alice\", \"age\": 18,\n \"sex\": \"female\"}\n ]\n\nThis would give the following result.\n\n+-----+-----+------+\n|name | age | sex |\n+-----+-----+------+\n|John | 30 | male |\n+-----+-----+------+\n|Alice| 18 |female|\n+-----+-----+------+\n\nAnother way is that you give `-l` option to specify that each line in the input\ncomprises a single JSON object. In this mode, each line must contain strictly\none JSON object::\n\n $ cat test.json\n {\"name\": \"John\", \"age\": 30, \"sex\": \"male\"}\n {\"name\": \"Alice\", \"age\": 18, \"sex\": \"female\"}\n $ json2xlsx test.ts -l -j test.json -o output.xlsx\n\nThis would give the same table as above.\n\nMultiple Rows\n-------------\nIf you would like to add more than one row, there are two ways to go.\nThe first one is that you can give an JSON array as input.\n\nad hoc Query Example\n--------------------\nWhen `-` is specified for input table script, the standard input is used.\n`--open` is specified, the generated xlsx file is opened immediately.\nThose two options are useful when you want to craete a xlsx file with\nan ad hoc query like this::\n\n $ json2xlsx - -j test.json -o output.xlsx --open\n table { \"name\"; \"age\"; \"sex\"; }\n ^D\n (MS Excel pops up immediately)\n\nRenaming Columns\n----------------\nKeys in a JSON file are often not appropriate for display use.\nFor example, you may want to use \"Full Name (Family, Given)\" instead of\na JSON key \"name\". You can use `as` modifiers to do this::\n\n table {\n \"name\" as \"Full Name (Family, Given)\";\n }\n\nYou can use `\"\\n\"` to wrap in a cell::\n\n table {\n \"name\" as \"Full Name\\n(Family, Given)\";\n }\n\nSaving a Few Types\n------------------\nIf a string literal does not contain any spaces, symbols or special characters,\nthe double quotations can be omitted. This table script::\n\n table { \"name\"; \"age\"; \"sex\"; }\n\nis equivalent to::\n\n table { name; age; sex; }\n\nDelimiter\n---------\nYou can use `,` instead of `;`::\n\n table { name; age; sex; }\n\n`,` and `;` are interchangable except for specifying coordinates.\n\nAdding Title to Table\n---------------------\nYou can put the table title between `table` and `{`::\n\n table \"Employee\" { name; age; sex; }\n\nThis will create a table like this.\n\n+------------------+\n|Employee |\n+-----+-----+------+\n|name | age | sex |\n+-----+-----+------+\n|John | 30 | male |\n+-----+-----+------+\n|Alice| 18 |female|\n+-----+-----+------+\n\nAdding Styles\n-------------\nYou can add styles to columns::\n\n table \"Analysis Summary\" border thinbottom {\n \"file_caption\" as \"Sample\" width 20 align right;\n \"nSeqs\" as \"# of \\nscaffolds\" align right halign center number \"#,#\";\n \"Min\" color \"green\" align right;\n \"_1st_Qu\" as \"1st quantile\" align right number \"#,#\";\n }\n\n1. `width` specifies the width of the column. The unit is unknown (I do not know), so please refer to the openpyxl document for details (although even I have not yet found the answer there).\n2. `align right`, `align center`, `align left` will align columns (without the heading) as specified.\n3. `halign right`, `halign center`, `halign left` will align the heading columns as specified.\n4. `color` specifies the color of the cell. See Color class in style.py of openpyxl for the complete list of the preset colors. Please let me know if you need hex-style colors (json2xlsx does not support it yet).\n5. `number` gives the number style of the cell. This will be described in details later.\n6. `border` adds a border to the cell. Currently, \"thinbottom\", \"thickbottom\" and \"doublebottom\" are the only available options. Please let me know if you find any use case in which you need others (Border class in style.py of openpyxl tells you what kinds of borders are available) and you would like to see it implemented.\n\nNumber Style\n------------\nThe number style is presumably an internal string used in MS Excel.\nHere are a couple of examples. See NumberFormat class in style.py\nof openpyxl for other examples.\n\n+---------------------+----------+-----------------------------------+\n| Number Format Style | Example | Description |\n+---------------------+----------+-----------------------------------+\n| `%` | 24% | Percentage |\n+---------------------+----------+-----------------------------------+\n| `#,##` | 123,456 | Insert ',' every 3 digits |\n+---------------------+----------+-----------------------------------+\n| `0.000` | 12.345 | Three digits after decimal point |\n+---------------------+----------+-----------------------------------+\n| `@` |24 | Force text |\n+---------------------+----------+-----------------------------------+\n| `yyyy-mm-dd` |2013/11/23| Date |\n+---------------------+----------+-----------------------------------+\n| `0.00+E00` |1.23+E10 | Scientific notation |\n+---------------------+----------+-----------------------------------+\n\nGrouping\n--------\nYou can group multiple columns. An example table script is here::\n\n table {\n \"name\";\n group \"personal info\" {\n \"age\",\n \"sex\";\n }\n }\n\nThe generated table will look like this.\n\n+-----+---------------+\n| | personal info |\n| +-------+-------+\n|name | age | sex |\n+-----+-------+-------+\n|John | 30 | male |\n+-----+-------+-------+\n\nNesting is allowed.\n\nMultiple Tables, Multiple Sheets\n--------------------------------\nYou can create multiple tables in a sheet::\n\n # You can write comments here.\n namesheet \"Employee List\";\n table { \"name\", \"age\", \"sex\"; }\n # equivalent to \"-l -j employee1.json\" in the command line\n load \"employee1.json\" linebyline;\n # vskip adds specified number of blank rows.\n vskip 1;\n table { \"company\", \"revenue\"; }\n # You can add as many files.\n load \"company1.json\";\n load \"company2.json\";\n # Create a new sheet. The first sheet is implicitly created so we did not need it.\n newsheet;\n namesheet \"Products\";\n table { \"product\", \"code\", \"price\"; }\n load \"product1.json\";\n load \"product2.json\";\n # You can add \"-o output.xlsx\" in the command line, but here we specify it in the script.\n write \"output.xlsx\";\n\nAdding a comment in a sheet\n---------------------------\nWe often want to add a comment to a spreadsheet::\n\n table { \"name\", \"age\", \"sex\"; }\n load \"employee1.json\";\n legend 2, 0 \"As of Apr. 2000\";\n\n`legend` command takes coordinates and a string, and writes the string in the cell.\nThe coordinates is a pair of two integers, *row, column*.\nIt originates at the cell right next to the top right of the table.\nBelow we show the coordinates.\n\n+-----+---------------+-------+-------+\n| | personal info | (0,0) | (0,1) |\n| +-------+-------+-------+-------+\n|name | age | sex | (1,0) | (1,1) |\n+-----+-------+-------+-------+-------+\n|John | 30 | male | (2,0) | (2,1) |\n+-----+-------+-------+-------+-------+\n\nCSV Support\n-----------\nComma Separated Values (CSV) is also supported.\nLet's see an example::\n\n table { \"name\", \"age\", \"sex\"; }\n loadcsv \"employee1.csv\";\n\nHere is the content of employee1.csv::\n\n \"John\",\"30\",\"male\"\n \"Alice\",\"18\",\"female\"\n\nNote that the order of the column must be the same as the column definition in the table.\nIf you would like to reorder the columns, you can specify the column order::\n\n table { \"sex\", \"age\", \"name\"; }\n loadcsv \"employee1.csv\" 2,1,0;\n\nYou can use `-1` for a blank column::\n\n table { \"sex\", \"blank\", \"name\"; }\n loadcsv \"employee1.csv\" 2,-1,0;\n\nWhen the first line of the input CSV file is a header, give `withheader`::\n\n table { \"sex\", \"age\", \"name\"; }\n loadcsv \"employee1.csv\" 2,1,0 withheader;\n\nthen you can skip the first line.\n\nMiscellanous\n------------\nYou can use non-ASCII characters. UTF-8 is the only supported coding.\n\nChangelog\n---------\n2016/05/26 FIX: work with newer pyparsing/openpyxl packages.\n2013/06/05 FIX: attributes did not show up when the table caption is specified.\n2013/06/05 ADD: better document on cell styles.\n2013/05/24 Initial upload to PyPI\n\nNote\n----\nSuggestions and comments are welcome.\n\nLicense\n-------\nModified BSD License.\n\nAuthor\n------\nMasahiro Kasahara", "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/mkasa/json2xlsx", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "json2xlsx", "package_url": "https://pypi.org/project/json2xlsx/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/json2xlsx/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/mkasa/json2xlsx" }, "release_url": "https://pypi.org/project/json2xlsx/1.3/", "requires_dist": null, "requires_python": null, "summary": "Tool to generate xlsx (Excel spreadsheet) from JSON", "version": "1.3" }, "last_serial": 2132630, "releases": { "1.2.4": [ { "comment_text": "", "digests": { "md5": "95b261990191eb49073c4e8a0ae6b462", "sha256": "32f457529adb2bc102169e147eae7722ad26c2b2abed9fcd1ebc74948167e4f4" }, "downloads": -1, "filename": "json2xlsx-1.2.4.tar.gz", "has_sig": false, "md5_digest": "95b261990191eb49073c4e8a0ae6b462", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10855, "upload_time": "2013-05-24T06:25:20", "url": "https://files.pythonhosted.org/packages/77/4a/9c851591bc631f13b424fe4aa968acb8ca44e7eb91849063568cbd696f14/json2xlsx-1.2.4.tar.gz" } ], "1.2.5": [ { "comment_text": "", "digests": { "md5": "91ec9393459fd28a743431d199034b9a", "sha256": "afe61d3bfaa9f55ea626004386b3dfd0ea29188767920e4f7910feb3cb277cdf" }, "downloads": -1, "filename": "json2xlsx-1.2.5.tar.gz", "has_sig": false, "md5_digest": "91ec9393459fd28a743431d199034b9a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11309, "upload_time": "2013-06-05T12:52:28", "url": "https://files.pythonhosted.org/packages/a8/c7/c08183d686fd87c7ab4f23d286938ee8e49751528110300b0b941db39e32/json2xlsx-1.2.5.tar.gz" } ], "1.3": [ { "comment_text": "", "digests": { "md5": "3dfa0d3aa2cf13089148aeeffcb57bcb", "sha256": "0349ef9eb62f56809cfd5789e7258ccb76b8ad45f453e09e40be212cbcbc9d94" }, "downloads": -1, "filename": "json2xlsx-1.3.tar.gz", "has_sig": false, "md5_digest": "3dfa0d3aa2cf13089148aeeffcb57bcb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11345, "upload_time": "2016-05-25T08:43:34", "url": "https://files.pythonhosted.org/packages/66/1a/2ef6311176f55e04db3947ce41fd06fa17a1919af5571f91bcaf21e1a33a/json2xlsx-1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3dfa0d3aa2cf13089148aeeffcb57bcb", "sha256": "0349ef9eb62f56809cfd5789e7258ccb76b8ad45f453e09e40be212cbcbc9d94" }, "downloads": -1, "filename": "json2xlsx-1.3.tar.gz", "has_sig": false, "md5_digest": "3dfa0d3aa2cf13089148aeeffcb57bcb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11345, "upload_time": "2016-05-25T08:43:34", "url": "https://files.pythonhosted.org/packages/66/1a/2ef6311176f55e04db3947ce41fd06fa17a1919af5571f91bcaf21e1a33a/json2xlsx-1.3.tar.gz" } ] }