18 lines
814 B
Python
18 lines
814 B
Python
import openpyxl
|
|
wb=openpyxl.load_workbook("한국임업진흥원.xlsx")
|
|
ws=wb.active
|
|
filled={}
|
|
for m in ws.merged_cells.ranges:
|
|
top=ws.cell(m.min_row,m.min_col).value
|
|
for r in range(m.min_row,m.max_row+1):
|
|
for c in range(m.min_col,m.max_col+1): filled[(r,c)]=top
|
|
def eff(r,c): return filled.get((r,c),ws.cell(r,c).value)
|
|
for r in range(3,ws.max_row+1):
|
|
k=str(ws.cell(r,11).value or "")
|
|
if "tech_02.do" in k:
|
|
e=[eff(r,c) for c in range(4,11)]
|
|
lbl=[x for x in e if x and str(x).strip()]
|
|
print(f"B{ws.cell(r,2).value} r{r}: D~J={'>'.join(str(x) for x in lbl)} | L={ws.cell(r,12).value} M={ws.cell(r,13).value} N={ws.cell(r,14).value} O={ws.cell(r,15).value}")
|
|
print(f" K={k.split('kofpi.or.kr')[1] if 'kofpi' in k else k}")
|
|
print("max_row:", ws.max_row)
|