import xlwings as xw
app = xw.App(visible=False, add_book=False)
app.display_alerts = False
app.screen_updating = False
wb = app.books.open('test.xlsx')
sht_sample = wb.sheets['Sample'] # 要复制的sheet
# 重点是copy
sht_sample.api.Copy(Before=sht_sample.api)
sht = wb.sheets['Sample (2)']
new_sheet_name = 'new sheet'
sht.api.Name = new_sheet_name
python xlwings复制一个sheet
最新推荐文章于 2024-07-11 09:33:13 发布