I'm trying to replicate excel formula in python using openpyxl.
Here, get_column_letter(n) is used to point to the relevant column.
date column contains data in this "2021-08-18 00:00:00" format.
from openpyxl import Workbook, load_workbook
from openpyxl.utils import get_column_letter
wb = load_workbook('Result.xlsx')
ws = wb.active
date = get_column_letter(3)
week = get_column_letter(11)
weekStart = get_column_letter(12)
weekEnd = get_column_letter(13)
weekName = get_column_letter(14)
for col in range(2, len(ws[date])+1):
ws[week + str(col)] = f"= WEEKNUM({date + str(col)})"
for col in range(2, len(ws[date])+1):
ws[weekStart + str(col)] = f"= MINIFS({date}:{date},{week}:{week},{week + str(col)})"
This is the excel output I get when I run the script Excel output
Here in this image Excel Formula you can see that an "@" is being appended by default to it. Any idea why this occurs and how to resolve it would be highly appreciated. Thanks.