Files
xkwsoftlist/trans_json2excel.py
2026-02-09 08:59:54 +08:00

21 lines
442 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import json
import openpyxl
from openpyxl import Workbook
# 读取和解析JSON数据
with open('data_cache.json', 'r') as file:
data = json.load(file)
# 创建一个新的Excel工作簿
wb = Workbook()
ws = wb.active
# 设置列标题
ws.append(["ID", "日期"])
# 遍历数据将每一项添加到Excel中
for id, date in data.items():
ws.append([id, date])
# 保存Excel文件
wb.save("上传日期篡改揭露总表.xlsx")