#coding=utf-8
import json, xlwt
json_path = r'json文件地址'
with open(json_path) as f:
monitor_all = json.load(f)
# print(type(score_all))
book = xlwt.Workbook() # 创建excel文件
sheet = book.add_sheet('sheet1') # 创建一个表
title = ['列1', '列2', '列3', ....]
for col in range(len(title)): # 存入第一行标题
sheet.write(0, col, title[col])
row = 1 # 定义行
for dict in monitor_all:
for key in dict:
sheet.write(row, title.index(key), dict[key])
row += 1
book.save('输出的Excel文件地址')
JSON文件导出Excel
最新推荐文章于 2025-03-24 15:26:52 发布