Getting AttributeError 'Workbook' object has no attribute 'add_worksheet' - while writing data frame to excel sheet
问题 I have following code and trying to write a data frame into an "Existing" worksheet of an Excel file (referred here as test.xlsx). Sheet3 is the targeted sheet, where I want to place the data and I don't want to replace the entire sheet with a new one. df = pd.DataFrame({'Data': [10, 20, 30, 20, 15, 30, 45]}) book = load_workbook('test.xlsx') writer = pd.ExcelWriter('test.xlsx') writer.book = book writer.sheets = dict((ws.title, ws) for ws in book.worksheets) # *I am not sure what is