17 lines
632 B
Python
17 lines
632 B
Python
import openpyxl, io, sys
|
|
wb=openpyxl.load_workbook("한국임업진흥원.xlsx")
|
|
ws=wb.active
|
|
out=io.open("_dump_out.txt","w",encoding="utf-8")
|
|
out.write(f"sheet:{ws.title} max_row:{ws.max_row}\n")
|
|
# show merged ranges
|
|
out.write("MERGES: "+", ".join(str(m) for m in sorted(ws.merged_cells.ranges, key=lambda r:(r.min_row,r.min_col)))+"\n\n")
|
|
for r in range(1,ws.max_row+1):
|
|
vals=[]
|
|
for c in range(2,18):
|
|
v=ws.cell(r,c).value
|
|
if v is not None and str(v).strip()!="":
|
|
vals.append(f"{openpyxl.utils.get_column_letter(c)}={v}")
|
|
out.write(f"{r}: "+" | ".join(vals)+"\n")
|
|
out.close()
|
|
print("done")
|