init python part (#7)

This commit is contained in:
KevinHuSh
2023-12-14 19:19:03 +08:00
committed by GitHub
parent 95c6cbbf45
commit f4456af464
21 changed files with 582328 additions and 0 deletions

View File

@ -0,0 +1,21 @@
from openpyxl import load_workbook
import sys
class HuExcelParser:
def __call__(self, fnm):
wb = load_workbook(fnm)
res = []
for sheetname in wb.sheetnames:
ws = wb[sheetname]
lines = []
for r in ws.rows:
lines.append(
"\t".join([str(c.value) if c.value is not None else "" for c in r]))
res.append(f"{sheetname}\n" + "\n".join(lines))
return res
if __name__ == "__main__":
psr = HuExcelParser()
psr(sys.argv[1])