import sys, io
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
sys.path.insert(0, r'D:\01.프로젝트\DB수집\작업파일\광역_사이트맵')
import importlib.util
spec = importlib.util.spec_from_file_location('chk', r'D:\01.프로젝트\DB수집\작업파일\광역_사이트맵\_검수체크.py')
chk = importlib.util.module_from_spec(spec); spec.loader.exec_module(chk)

PKG = r'D:\01.프로젝트\DB수집\작업파일\_제출패키지_2026-06-03\프리랜서1\충청남도_부여군.xlsx'
WRK = r'D:\01.프로젝트\DB수집\작업파일\광역_사이트맵\충청남도\7.부여군\충청남도_부여군.xlsx'
for tag, p in (('PKG', PKG), ('WORK', WRK)):
    n, issues = chk.inspect(p)
    print(f'\n===== {tag}: {p} | 데이터 {n}행 =====')
    if issues:
        print(f'FAIL — {len(issues)}건:')
        for x in issues: print('   ✗', x)
    else:
        print('PASS')

# extra: raw row scan on PKG for blank rows / sheet info
import openpyxl
wb = openpyxl.load_workbook(PKG); ws = wb.active
print(f'\n--- PKG sheet={ws.title!r} dims={ws.dimensions} max_row={ws.max_row} max_col={ws.max_column} ---')
# fully blank rows within data region
blank=[]
for r in range(3, ws.max_row+1):
    if all(ws.cell(r,c).value in (None,'') for c in range(1, ws.max_column+1)):
        blank.append(r)
print('완전빈행(3~max):', blank)
# rows where B empty but some content
partial=[]
for r in range(3, ws.max_row+1):
    bv=ws.cell(r,2).value
    hascontent=any(ws.cell(r,c).value not in (None,'') for c in range(3, ws.max_column+1))
    if (bv in (None,'')) and hascontent:
        partial.append(r)
print('B빈칸+내용있음:', partial[:40], '... 총', len(partial))
