def excel_to_json(file_name):
wb = load_workbook(file_name)
all_data = defaultdict(list)
for sheet_name in wb.sheetnames:
rows = list(wb[sheet_name].rows)
title = [i.value for i in rows[0]]
for row in rows[1:]:
data = [i.value for i in row]
all_data[sheet_name].append(dict(zip(title, data)))
return all_data

相关文章:

  • 2022-01-01
  • 2022-12-23
  • 2022-12-23
  • 2021-11-26
  • 2022-02-12
  • 2022-12-23
  • 2021-09-05
猜你喜欢
  • 2021-06-06
  • 2022-12-23
  • 2021-12-04
  • 2022-12-23
  • 2021-08-28
  • 2021-04-28
相关资源
相似解决方案