import sys, io sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') import openpyxl from openpyxl.utils import get_column_letter PKG = r'D:\01.프로젝트\DB수집\작업파일\_제출패키지_2026-06-03\프리랜서1\충청남도_부여군.xlsx' ws = openpyxl.load_workbook(PKG).active def bd(cell): b=cell.border; f=lambda s:(s.style or '-')[:4] return f'{f(b.left)}/{f(b.right)}/{f(b.top)}/{f(b.bottom)}' def in_merge(r,c): for m in ws.merged_cells.ranges: if m.min_row<=r<=m.max_row and m.min_col<=c<=m.max_col: return str(m) return '' for r in (551,552,568,233): print(f'\n=== row {r} ===') for c in range(2,28): mk=in_merge(r,c) print(f' {get_column_letter(c)}{r}={bd(ws.cell(r,c))}{(" M="+mk) if mk else ""}') # How many rows have a cell with PARTIAL border (some sides missing) in B..W (excl X) non-merge? print('\n=== rows with incomplete border vs 233 template (non-merge, B..W excl X) ===') tmpl={c:ws.cell(233,c).border for c in range(2,28)} def sides(b): return (b.left.style,b.right.style,b.top.style,b.bottom.style) bad=set() for r in range(3,ws.max_row+1): for c in range(2,28): if c==24: continue if in_merge(r,c): continue if sides(ws.cell(r,c).border)!=sides(tmpl[c]): bad.add(r) print('rows differing from 233 template:', len(bad)) import itertools def ranges(lst): lst=sorted(lst); out=[] for x in lst: if out and x==out[-1][1]+1: out[-1][1]=x else: out.append([x,x]) return [(a,b) for a,b in out] print(ranges(bad)[:25])