简体   繁体   中英

open excel file on sheet1 after changes with xlwings

I need an Excel workbook to open on sheet1 or by that sheets name. I'm using xlwings to alter a workbook with several sheets. Everything works fine but when the file is opened in Excel it opens on the last sheet that has been altered. I can't seem to find an answer. Please help. Thanks

This is what might help you

# load Workbook
workbook= xw.Book('path_file')

#acivate sheet by name
sheet = workbook.sheets.activate('Sheet_Name')

if that doesn't work try

sheet = workbook.sheets["Sheet_Name"]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM