I am trying to use ExcelWriter to write / add some information to a workbook containing multiple sheets. The first time I use this function, I create a book with some data. In the second call, I would like to add some information to the book in different places on all the sheets.
def Out_Excel(file_name,C,col):
writer = pd.ExcelWriter(file_name,engine='xlsxwriter')
for tab in tabs:
df = DataFrame(C)
df.to_excel(writer,sheet_name = tab, startcol = 0 + col, startrow = 0)
writer.save()
In the main code, I call this function twice with different columns to print my data in different places.
Out_Excel('test.xlsx',C,0)
Out_Excel('test.xlsx',D,10)
But the problem is that the output is just the second call to the function, as if the function was overwriting the entire book. I think I need to download a book that already exists in this case? Any help?
Hamed source
share