I'm working on a Windows 10 machine (win32, Python 3.8.2). I'm using pandas to read in two excel files as dataframes, then using Openpyxl to write data to an existing Excel file (that has data and formulas already in the sheet). The approach I'm using now with Openpyxl works, but is quite time-consuming. I'm wondering if there's another, faster approach to writing data to an existing Excel sheet? I feel like this could possibly be done by appending my dataframe(s) to the existing Excel sheet, but I've read online that the sheet I am writing to would have all of its data erased before my data is written to it. Here are some of the resources I've read about this issue on:
Asked
Active
Viewed 562 times
1 Answers
0
I would pull it in with pd.read_csv(), do manipulations then write with df.to_csv(). Do you need to keep it in the excel format? I tend to find that this is not worth it.

Keith
- 4,646
- 7
- 43
- 72
-
Thanks for the quick reply. I'm reading the excel files in right now using pd.read_excel(). I do need to keep it in the excel format which contains formulas, images, and cell formatting. I'm using openpyxl's load_workbook() to load the excel file I am writing to then writing the data to this file by setting cell values to data from my dataframe(s). For instance, sheet.cell(row=x, column=y).value = df.iloc[j, k] `code` where x, y, j, k are arbitrary values here. – user3190746 May 13 '20 at 20:39