# -*- coding: utf-8 -*-
import sys, io, openpyxl
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
P=r'3.한국의약품안전관리원/한국의약품안전관리원.xlsx'
D1={'의약품 이상사례보고','의약품 안전관리','DUR 정보','부작용 피해구제','임상시험안전지원','알림마당','교육·홍보','정보공개','기관소개'}
wb=openpyxl.load_workbook(P); ws=wb.active
fixed=[]
for r in range(3, ws.max_row+1):
    d=ws.cell(r,4).value; e=ws.cell(r,5).value; f=ws.cell(r,6).value
    if d in D1 and (e in (None,'')) and (f in (None,'')):
        # pure category header → clear K..Q
        for c in range(11,18):  # K(11)..Q(17)
            ws.cell(r,c).value=None
            ws.cell(r,c).hyperlink=None
        fixed.append((r,d))
wb.save(P)
for r,d in fixed: print('cleared d1 header row',r,d)
print('total',len(fixed))
