I have an excel workbook with one worksheet called Trades. In this worksheet, columns A-E are blank and columns F-J contain formulas that use A-E as inputs. I would like to insert data from a pandas dataframe into columns A-E in the excel workbook and save it so I can open it up outside of python.
Looking at the online documentation, I've used pandas ExcelWriter:
with ExcelWriter("path_to_file.xlsx", mode="a", engine="openpyxl", if_sheet_exists="overlay") as writer:
df1.to_excel(writer, sheet_name="Trades")
Where df1 is the new dataframe to be inserted into the "path_to_file" workbook.
When I run this it ends up creating another sheet (Trades1) in the workbook that contains the data I'd like to be inserted in the original sheet. Anyone know what might be at issue?