generate excel by json
Project description
json2xls:根据json数据生成excel表格
==================================
[![](https://badge.fury.io/py/json2xls.png)](http://badge.fury.io/py/json2xls)
[![](https://pypip.in/d/json2xls/badge.png)](https://pypi.python.org/pypi/json2xls)
json2xls不支持多层套嵌的json数据,只可以根据一层json生成表格
**安装**
pip install json2xls
**根据json数据生成excel**
code:
:::python
from json2xls import Json2Xls
json_data = '{"name": "ashin", "age": 16, "sex": "male"}'
Json2Xls('test.xls', json_data)
command:
python json2xls.py test3.xls '{"a":"a", "b":"b"}'
# from file
python json2xls.py test3.xls "`cat data.json`"
excel:
age | name | sex
----|------|----
30 | John | male
18 | Alice| female
**根据请求url返回的json生成excel**
默认请求为get,get请求参数为params={}, post请求参数为data={}
code:
:::python
from json2xls import Json2Xls
url = 'http://api.bosonnlp.com/sentiment/analysis'
Json2Xls('test.xlsx', url, method='post')
command:
python json2xls.py test.xls http://api.map.baidu.com/telematics/v3/weather\?location\=%E4%B8%8A%E6%B5%B7\&output\=json\&ak\=640f3985a6437dad8135dae98d775a09
excel:
status | message
-------|--------
403 | no token header
History
-------
0.0.1 (2014-09-23)
---------------------
* First release on PyPI.
==================================
[![](https://badge.fury.io/py/json2xls.png)](http://badge.fury.io/py/json2xls)
[![](https://pypip.in/d/json2xls/badge.png)](https://pypi.python.org/pypi/json2xls)
json2xls不支持多层套嵌的json数据,只可以根据一层json生成表格
**安装**
pip install json2xls
**根据json数据生成excel**
code:
:::python
from json2xls import Json2Xls
json_data = '{"name": "ashin", "age": 16, "sex": "male"}'
Json2Xls('test.xls', json_data)
command:
python json2xls.py test3.xls '{"a":"a", "b":"b"}'
# from file
python json2xls.py test3.xls "`cat data.json`"
excel:
age | name | sex
----|------|----
30 | John | male
18 | Alice| female
**根据请求url返回的json生成excel**
默认请求为get,get请求参数为params={}, post请求参数为data={}
code:
:::python
from json2xls import Json2Xls
url = 'http://api.bosonnlp.com/sentiment/analysis'
Json2Xls('test.xlsx', url, method='post')
command:
python json2xls.py test.xls http://api.map.baidu.com/telematics/v3/weather\?location\=%E4%B8%8A%E6%B5%B7\&output\=json\&ak\=640f3985a6437dad8135dae98d775a09
excel:
status | message
-------|--------
403 | no token header
History
-------
0.0.1 (2014-09-23)
---------------------
* First release on PyPI.
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
json2xls-0.0.1.tar.gz
(13.1 kB
view hashes)
Built Distributions
json2xls-0.0.1-py2.7.egg
(7.5 kB
view hashes)
Close
Hashes for json2xls-0.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16b209526e9237f49f72d6695eb6b33862054fca214c5ef51dc83ae9d5f87954 |
|
MD5 | aa00f604407787bca60e67eb98fc8cdb |
|
BLAKE2b-256 | df71c3293d3bba1e21fff94bfb0e2a9149d9cb45f8b1d1f478bd09319ded6dfa |