Skip to main content

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.

Project details


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)

Uploaded Source

Built Distributions

json2xls-0.0.1-py2.py3-none-any.whl (5.6 kB view hashes)

Uploaded Python 2 Python 3

json2xls-0.0.1-py2.7.egg (7.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page