简体   繁体   English

使用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

I do a lot of data analysis in Excel and have been exploring Python and DataNitro to streamline my workflow. 我在Excel中进行了大量的数据分析,并一直在探索Python和DataNitro来简化我的工作流程。 I specifically am trying to copy certain cells from one sheet in one Excel workbook, and paste them into certain cells in a certain sheet in another Excel workbook. 我特别试图在一个Excel工作簿中复制一个工作表中的某些单元格,并将它们粘贴到另一个Excel工作簿中的某个工作表中的某些单元格中。 I have been storing ("copying") using CellRange (DataNitro), but am not sure how to copy the stored contents into a particular sheet, in another Excel workbook. 我一直在使用CellRange(DataNitro)存储(“复制”),但不知道如何将存储的内容复制到另一个Excel工作簿中的特定工作表中。 Any clue how I may go about this? 我有什么想法可以解决这个问题吗? Also, is it possible to make the range defined for a CellRange conditional on certain cell properties? 此外,是否可以使CellRange的定义范围以某些单元格属性为条件?

I would really appreciate any help! 我真的很感激任何帮助! Thank you, all. 谢谢你们。

Here's an example of copying: 这是一个复制的例子:

data = CellRange("A1:A10").value
active_wkbk("Book2.xlsx")
CellRange("A1:A10").value = data

You can make the range conditional using regular Python logic ( if statements, etc.). 您可以使用常规Python逻辑( if语句等)使范围成为条件。

暂无
暂无

声明:本站的技术帖子网页,遵循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 将 excel 工作簿中的内容复制到另一个工作簿而不丢失 excel 格式 - How to copy contents from a sheet of an excel workbook to another workbook without loosing the excel formatting using python 如何使用python将Excel工作表复制到具有相同格式的另一个工作簿 - How to copy excel sheet to another workbook with same format using python 使用python将Excel工作簿表合并为一个 - Combining excel workbook sheet into one using python 如何在 Python 中将 Excel 工作表复制到另一个工作簿 - How to copy over an Excel sheet to another workbook in Python Python从另一个工作簿xlwt附加excel表 - Python append excel sheet from another workbook xlwt 用python加密excel工作簿表 - encrypting excel workbook sheet with python 使用工作表名称作为键从python中的Excel工作簿创建字典 - Creating dictionary from excel workbook in python using sheet names as key 有没有办法将特定列从 Excel 工作表(例如 sheet_1)复制到 sheet_2 中的另一列? 使用 Python - Is there any way to copy a particular column from excel sheet (say sheet_1) to the other column which is in sheet_2? Using Python Python 代码不在 Excel 工作表中写入输出,但能够从同一工作簿中的另一个工作表获取输入 - Python code not writing output in excel sheet but is able to take input from another sheet in same workbook
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM