I am trying to write to an excel file and then load the result into a DF. However, calculated values are returning N/A in the DF even though when I open the excel sheet they are correctly displayed.
If I open and then save the excel sheet manually after updating using python, loading the dataframe works.
Here is the code:
from openpyxl import load_workbook
import pandas as pd
if __name__ == '__main__':
portfolio_values = getBalances('USD')
wb = load_workbook(filename = 'Client_Portfolio_Tracker.xlsx')
clients = wb['Clients']
clients['F2'] = portfolio_values
clients['G2'] = datetime.datetime.now().strftime("%m/%d/%y %H:%M")
wb.save('Client_Portfolio_Tracker.xlsx')
client_df = pd.read_excel('Client_Portfolio_Tracker.xlsx', sheetname = 'Clients')
print(client_df)
Thanks in advance!