Files
Astatin3 c7b5427fae swapped over to json for output
If two servers were found at the same time, they might try to write to the xlsx file  at the same time. this could corrupt the file. outputting to json, and just using another script to convert is much safer.
2023-09-05 07:23:38 -06:00

18 lines
482 B
Python

import sys
import json
from openpyxl import Workbook
inputfile = sys.argv[1]
outputfile = sys.argv[2]
book = Workbook()
sheet = book.active
sheet.append(("ip", "latency", "pver", "ver", "cplayers", "mplayers", "motd", "isicon"))
with open(inputfile) as f:
data = json.load(f)
for entry in data:
sheet.append((entry["ip"], entry["latency"], entry["pver"], entry["ver"], entry["cplayers"], entry["mplayers"], entry["motd"], entry["isicon"]))
book.save(outputfile)