How to convert JSON to XLS in Python

橙三吉。 提交于 2019-11-27 22:15:22

问题


Does anyone know how can I convert JSON to XLS in Python?

I know that it is possible to create xls files using the package xlwt in Python.

What if I want convert a JSON data convert to XLS file directly?

Is there a way to archive this?


回答1:


I usually use tablib for this use. Its pretty simple to use: https://pypi.python.org/pypi/tablib/0.9.3




回答2:


Using pandas (0.15.1) and openpyxl (1.8.6):

import pandas
pandas.read_json("input.json").to_excel("output.xlsx")


来源:https://stackoverflow.com/questions/15379178/how-to-convert-json-to-xls-in-python

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!