공공기관2 작업 중. _temp 몽타주(재생성가능)는 제외. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""시각판정 N 보정 적용: python _n_fix.py <num> '{"39":"어문","44":"어문"}'
|
|
변경 셀(N=14열)에 하늘색(FFBDD7EE) fg+bg + 값 교체. 행번호=엑셀 실제 행."""
|
|
import io, sys, os, json, glob
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
|
import openpyxl
|
|
from openpyxl.styles import PatternFill
|
|
|
|
BASE = r"D:\01.프로젝트\DB수집\작업파일\공공기관2"
|
|
BLUE = PatternFill("solid", fgColor="FFBDD7EE", bgColor="FFBDD7EE")
|
|
|
|
def main():
|
|
num = sys.argv[1]
|
|
fixes = json.loads(sys.argv[2])
|
|
fp = glob.glob(os.path.join(BASE, f"{num}.*", "*.xlsx"))
|
|
fp = [x for x in fp if "_backup" not in x and "~$" not in x][0]
|
|
wb = openpyxl.load_workbook(fp)
|
|
ws = wb.active
|
|
changed = 0
|
|
for r, newN in fixes.items():
|
|
cell = ws.cell(int(r), 14)
|
|
old = cell.value
|
|
if old != newN:
|
|
cell.value = newN
|
|
cell.fill = BLUE
|
|
changed += 1
|
|
print(f" r{r}: {old} → {newN}")
|
|
wb.save(fp)
|
|
print(f"[{os.path.basename(fp)}] {changed}행 변경")
|
|
|
|
if __name__ == '__main__':
|
|
main()
|