공공기관2 작업 중. _temp 몽타주(재생성가능)는 제외. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
44 lines
1.8 KiB
Python
44 lines
1.8 KiB
Python
# -*- coding: utf-8 -*-
|
|
import openpyxl, sys
|
|
from openpyxl.utils import get_column_letter
|
|
sys.stdout.reconfigure(encoding='utf-8')
|
|
wb=openpyxl.load_workbook('_충청남도_서천군_NEW.xlsx'); ws=wb.active
|
|
print('dims', ws.dimensions, 'max_row', ws.max_row)
|
|
# B continuity
|
|
bvals=[ws.cell(r,2).value for r in range(3,ws.max_row+1)]
|
|
print('B first', bvals[:3], 'last', bvals[-3:], 'continuous?', bvals==list(range(1,len(bvals)+1)))
|
|
# hyperlink alignment check: for rows with L in page/게시판, K value should == hyperlink target
|
|
mis=0; nolink=0
|
|
for r in range(3, ws.max_row+1):
|
|
L=ws.cell(r,12).value; c=ws.cell(r,11)
|
|
if L in ('페이지','게시판','사이트'):
|
|
tgt=c.hyperlink.target if c.hyperlink else None
|
|
val=c.value
|
|
if L=='사이트' and not tgt: continue
|
|
if tgt is None: nolink+=1
|
|
elif isinstance(val,str) and val.strip()!=tgt.strip(): mis+=1
|
|
print('hyperlink mismatches:', mis, 'missing links:', nolink)
|
|
def show(r):
|
|
vals=[]
|
|
for c in range(2,16):
|
|
v=ws.cell(r,c).value
|
|
if v is not None: vals.append(f'{get_column_letter(c)}={str(v)[:16]}')
|
|
tgt=ws.cell(r,11).hyperlink.target[:46] if ws.cell(r,11).hyperlink else ''
|
|
print(f'R{r:>3} '+' | '.join(vals)+(f' [{tgt}]' if tgt else ''))
|
|
# find 사전정보공표 block
|
|
sj=None
|
|
for r in range(3,40):
|
|
if ws.cell(r,6).value=='사전정보공표': sj=r; break
|
|
print(f'=== 사전정보공표 block @R{sj} (expect 12) ===')
|
|
for r in range(sj, sj+13): show(r)
|
|
# merges around it
|
|
print('--- merges touching F/G in that block ---')
|
|
for m in ws.merged_cells.ranges:
|
|
if m.min_col in (6,7) and m.min_row>=sj-1 and m.min_row<=sj+13:
|
|
print(' ', str(m))
|
|
print('=== 민원편의시책 group ===')
|
|
for r in range(3,ws.max_row+1):
|
|
if ws.cell(r,6).value=='민원편의시책':
|
|
for k in range(r, r+12): show(k)
|
|
break
|