I want to save a data frame to the second sheet of a file but I can't do that and I don't know why.
yfile = openpyxl.load_workbook(new_file, data_only=True)
ws = yfile.worksheets[0]
sheet2 = yfile.create_sheet()
ws2 = yfile.get_sheet_by_name("Sheet").title = "Analysis"
writer = pd.ExcelWriter(yfile, engine='xlsxwriter')
df3.to_excel(writer, sheet_name='Analysis')
writer.save()
yfile.save(new_file)
I have created the sheet 'Analysis' but when I save in it I received the following response: "AttributeError: 'Workbook' object has no attribute 'write'"
What I have to modify?