11 lines
538 B
Python
11 lines
538 B
Python
def reconstruct_formula(formula, wb_v, sheet_name):
|
|
"""수식 내 셀 주소를 실제 값으로 치환 및 기호 가독화"""
|
|
if not formula or not str(formula).startswith('='): return str(formula)
|
|
ref_pattern = r"(?:'([^']+)'|([a-zA-Z0-9가-힣]+))?!([A-Z]+\d+)|([A-Z]+\d+)"
|
|
|
|
def replace_with_value(match):
|
|
s_name = match.group(1) or match.group(2) or sheet_name
|
|
coord = match.group(3) or match.group(4)
|
|
try:
|
|
val = wb_v[s_name][coord].value
|
|
if val is None: return "0" |