简体   繁体   中英

copy a worksheet in openpyxl

I'm using openpyxl (unfortunately I don't know how to find out my version number, installed it about a month ago) on Windows with python 2.7 and want to copy a worksheet that I generated using a template.xlsx file to a new workbook. The template has a single worksheet that I alter. I want to load it n times and copy each version as a new worksheet to another workbook. Could also be the same workbook ifneedbe.

I found some hints here which took me here . The example doesn't work as it seems the add_sheet() method has been removed.

primary.add_sheet(copy.deepcopy(ws),ido+1)
AttributeError: 'Workbook' object has no attribute 'add_sheet'

Also couldn't find anything helpful in the API .

恐怕不支持复制工作表,因为这远非易事。

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