简体   繁体   English

如何使用python将数据从一个工作表添加到另一个工作簿中的现有工作表而不覆盖其他工作表的数据?

[英]How to add data using python from one sheet to an existing sheet in another workbook without overwriting other sheet's data?

I have an two excel files 'file1' and 'file2'. 我有两个excel文件'file1'和'file2'。 file1 has data filled in 3 sheets. file1的数据填写为3张。 I want to copy data from file2 and append it into sheet3 in file1 and save the same file. 我想从file2复制数据并将其附加到file1中的sheet3并保存相同的文件。 Can anyone help me do this using python? 任何人都可以帮我用python做这个吗?

xlwt is used to write into existing files. xlwt用于写入现有文件。

Here is the similar thread to your question. 这是与您的问题类似的主题。 . .

writing to existing workbook using xlwt 使用xlwt写入现有工作簿

If you are using Windows, you can try PyWin32 to directly run Excel. 如果您使用的是Windows,则可以尝试使用PyWin32直接运行Excel。

from win32com.client import Dispatch
xlApp = Dispatch("Excel.Application")
...

Some recipes here . 这里有一些食谱。

NOTE: You will need to install PyWin32 binary. 注意:您需要安装PyWin32二进制文件。

暂无
暂无

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

相关问题 如何使用 Python 将数据从一个 Excel 工作表复制到同一工作簿的另一工作表? - How to copy data from One Excel sheet to another sheet for same Workbook Using Python? 使用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 Pandas在不更改任何数据的情况下将列从一张纸复制到另一张纸? - Python Pandas copy columns from one sheet to another sheet without changing any data? 如何使用 python 将 excel 工作簿中的内容复制到另一个工作簿而不丢失 excel 格式 - How to copy contents from a sheet of an excel workbook to another workbook without loosing the excel formatting using python 使用条件语句 Python 从一张纸到另一张纸的数据 map - Data map from one sheet to another using Conditional statement Python python:将数据框更新到现有的excel工作表,而不会覆盖同一工作表和其他工作表上的内容 - python: update dataframe to existing excel sheet without overwriting contents on the same sheet and other sheets Python - Excel - 将工作表添加到现有工作簿而不删除工作表 - Python - Excel - Add sheet to existing workbook without removing sheets 使用熊猫,如何只从 Excel 工作簿中读取一张工作表而不加载任何其他工作表? - Using pandas, how to only read one sheet from Excel workbook without loading any of the other sheets? 将工作表添加到另一个工作簿中创建的工作簿 - Add sheet to created workbook from another workbook 在python中将新工作表添加到现有工作簿 - Add a new sheet to a existing workbook in python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM