小编idi*_*lus的帖子

使用Openpyxl将工作表从一个工作簿复制到另一工作簿

我有大量的EXCEL文件(即200个),我想将一个特定的工作表从一个工作簿复制到另一个工作簿。我做了一些调查,但找不到使用Openpyxl的方法

这是我到目前为止开发的代码

def copy_sheet_to_different_EXCEL(path_EXCEL_read,Sheet_name_to_copy,path_EXCEL_Save,Sheet_new_name):
''' Function used to copy one EXCEL sheet into another file.

    def path_EXCEL_read,Sheet_name_to_copy,path_EXCEL_Save,Sheet_new_name


Input data:
    1.) path_EXCEL_read: the location of the EXCEL file along with the name where the information is going to be saved
    2.) Sheet_name_to_copy= The name of the EXCEL sheet to copy
    3.) path_EXCEL_Save: The path of the EXCEL file where the sheet is going to be copied
    3.) Sheet_new_name: The name of the new EXCEL sheet

Output data:
    1.) Status= If 0, …
Run Code Online (Sandbox Code Playgroud)

excel copy worksheet python-3.x openpyxl

6
推荐指数
4
解决办法
1万
查看次数

标签 统计

copy ×1

excel ×1

openpyxl ×1

python-3.x ×1

worksheet ×1