When working with the with open
method in Python I was expecting to just be able to write the data once and re open it.
I am using a for
loop that involves me reopening the file to write another row in a excel file. I can write one but the second it reopens it just overwrites the row.
How do I save the row and have it re open and create a new row?
with pd.ExcelWriter("schoolsheet.xlsx", mode="a", if_sheet_exists="overlay") as writer:
print("made it here")
df.to_excel(writer)
print("concludes writing to file")