sheet_name = f'{self.date_selected.year}年{self.date_selected.month}月'
writer = pd.ExcelWriter(f'{self.path}\\门店助手\\门店排班表.xlsx')
book = load_workbook(writer.path)
if sheet_name in book.sheetnames:
del book[sheet_name]
writer.book = book
self.table.to_excel(writer, sheet_name)
writer.save()
writer.close()
QMessageBox.information(self, "提示信息", "保存成功!", QMessageBox.Ok)
self.table.to_excel(writer, f'{self.date_selected.year}年{self.date_selected.month}月')
writer.save()
writer.close()
如何把Dataframe保存到EXCEL的不同SHEET中!
![](https://img-home.csdnimg.cn/images/20240711042549.png)