'Formulas are nan values in Pandas/Openpyxl
When I am inserting formulas using openpyxl in an excel like such:
#multiple rows
#execution hit on both sides?
from openpyxl import load_workbook
wb = load_workbook(filename = 'flat_user_data.xlsx')
ws = wb.active
for i in ws.iter_rows(min_row=10, max_row= 10799):
i = i[0].row
ws[f"N{i}"] = f'=IF(COUNTIFS(A{i-1}:A{i+1},A{i},D{i-1}:D{i+1},D{i},M{i-1}:M{i+1},True)>1,IF(COUNTIFS(A{i-1}:A{i+1},A{i},D{i-1}:D{i+1},D{i},M{i-1}:M{i+1},True)=2,True,"INVESTIGATE"),False)'
wb.save('flat_user_data.xlsx')
When I load the subsequent df I get for these rows only NaN values.. However when I open the excel file and save it these values become the
Is there a way to open the excel file, read the contents via code so that this does not need to happen manually?
Would love to hear your thoughts! Please help
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
