DB_JOB/작업파일/_스크립트/_fix_buyeo_height.py
hehihoho3 df16c98366 백업: DB수집 전체 스냅샷 (공공기관2 정리 전)
공공기관2 작업 중. _temp 몽타주(재생성가능)는 제외.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 18:15:40 +09:00

27 lines
1.1 KiB
Python

import sys, io, shutil, os
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
import openpyxl
PKG = r'D:\01.프로젝트\DB수집\작업파일\_제출패키지_2026-06-03\프리랜서1\충청남도_부여군.xlsx'
WRK = r'D:\01.프로젝트\DB수집\작업파일\광역_사이트맵\충청남도\7.부여군\충청남도_부여군.xlsx'
for P in (PKG, WRK):
BK = P.replace('.xlsx', '_backup_행높이정규화전.xlsx')
if not os.path.exists(BK):
shutil.copy2(P, BK)
wb = openpyxl.load_workbook(P); ws = wb.active
fixed = 0
for r in range(1, ws.max_row + 1):
if ws.row_dimensions[r].height not in (15.0, None):
ws.row_dimensions[r].height = 15.0
fixed += 1
wb.save(P)
print(f'{os.path.basename(P)}: 높이정규화 {fixed}행 -> 15.0, saved (backup {os.path.basename(BK)})')
# verify
for tag, P in (('PKG', PKG), ('WRK', WRK)):
ws = openpyxl.load_workbook(P).active
from collections import Counter
hc = Counter(ws.row_dimensions[r].height for r in range(1, ws.max_row + 1))
print(f'{tag} height histogram: {dict(hc)} max_row={ws.max_row}')