I am trying to write a dataframe to an existing excel document without having to load the workbook.
The reason is because my excile file contains many pivot table which can not be read-in to python. Therefore i want to know whether it is possible to write directly to the excel file (and specific sheet) without having to load the workbook.
I have previously tried writing to an excel file, but this simply deletes the other existing sheets and just leaves the data i have written in. so to clarify i will need to make sure the other sheets are not deleted.
thanks in advance.
as background, this code will NOT work for me
path = xxxxxxx
#loading workbook
book = load_workbook(path)
# book = load_workbook(path, read_only=False, keep_vba=True)
#object which writes to the workbook
writer = pd.ExcelWriter(path, engine='openpyxl')
#where object and loadworkbook are introduced
writer.book = book
#writing in all sheet names from the workbook
writer.sheets = dict((ws.title, ws) for ws in book.worksheets)