简体   繁体   English

如何使用 python 将 excel 工作簿中的内容复制到另一个工作簿而不丢失 excel 格式

[英]How to copy contents from a sheet of an excel workbook to another workbook without loosing the excel formatting using python

I have an excel sheet with specific formatting done.我有一张 excel 表格,并完成了特定的格式化。 I need to copy this sheet to another workbook(excel sheet) without loosing the formatting(colour combination, wrap texting, cell size etc.) using python我需要使用 python 将此表复制到另一个工作簿(excel 表)而不丢失格式(颜色组合、换行、单元格大小等)

Copying just the data is easy enough> Formatting & styles are part of the workbook, to maintain these need to be copied as well.仅复制数据很容易> 格式化和 styles 是工作簿的一部分,为了维护这些也需要复制。 You don't say if the 'another workbook' is existing or you want to copy the sheet to a newly created workbook.您没有说“另一个工作簿”是否存在,或者您想将工作表复制到新创建的工作簿中。 If the later then making copies of the workbook with a new name is probably easier even if it contains extra sheets you need to delete.如果后者使用新名称复制工作簿可能会更容易,即使它包含您需要删除的额外工作表。 If the later look at the discussion in the following link has options in Solution 2 and 3 which use pywin32 and xlwings respectively.如果稍后查看以下链接中的讨论,解决方案 2 和 3 中的选项分别使用 pywin32 和 xlwings。 How to copy over an Excel sheet to another workbook in Python 如何将 Excel 工作表复制到 Python 中的另一个工作簿

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Python(和DataNitro)将单元格从一个Excel工作簿中的特定工作表复制到另一个Excel工作簿中的特定工作表 - Using Python (and DataNitro) to copy cells from a particular sheet in one Excel workbook, to a particular sheet in another Excel workbook 如何使用python将Excel工作表复制到具有相同格式的另一个工作簿 - How to copy excel sheet to another workbook with same format using python 如何使用 Python 将数据从一个 Excel 工作表复制到同一工作簿的另一工作表? - How to copy data from One Excel sheet to another sheet for same Workbook Using Python? 如何在 Python 中将 Excel 工作表复制到另一个工作簿 - How to copy over an Excel sheet to another workbook in Python 将受保护的Excel工作簿复制到另一个工作簿python中 - Copy Protected excel workbook into another workbook python 在python中格式化Excel而不加载工作簿 - Excel formatting in python without loading workbook Python从另一个工作簿xlwt附加excel表 - Python append excel sheet from another workbook xlwt 使用python将Excel工作簿表合并为一个 - Combining excel workbook sheet into one using python 如何使用Python合并来自不同工作簿的多个同名excel工作表并保存到新的excel工作簿中 - How to merge multiple excel sheet with the same name from different workbooks and save into a new excel workbook using Python 使用工作表名称作为键从python中的Excel工作簿创建字典 - Creating dictionary from excel workbook in python using sheet names as key
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM