[英]Excel to copy / paste some cells from one sheet to another but with a twist
[英]Copy cells from excel sheet and paste it to a DB query Sikuli
我是Sikuli的新手。 我需要从excel工作表中复制数据,然后使用sikuli脚本将其粘贴到数据库查询中。 以及如何在Excel单元格之间迭代以重复复制和粘贴数据。
这些数据需要一个接一个地复制和粘贴。
一次复制所有单元格,然后将它们一个个粘贴,可能会更容易。
一旦Sikuli打开Excel,您可以执行以下操作:
type(Key.HOME, KeyModifier.CTRL) #takes you to cell A1
type("a", KeyModifier.CTRL) #select all
type("c", KeyModifier.CTRL) #copy to clipboard
fromExcel = Env.GetClipboard().strip() #get clipboard contents into Sikuli, without leading or trailing white space
cells = fromExcel.split("/n") #split each cell into list on newline
#go to the destination app, maybe using App.open("nameOfYourApp") if it's not open yet, or App.focus("nameOfYourApp") if it is already open
for cell in cells: #use python to iterate through your list
#navigate to the line or cell where you want to paste
paste(cell)
这样的事会有帮助吗?
除了提供特定的方法外,让我们了解一下您所拥有的选项。
注意 :在所有情况下,您显然都必须考虑如何将自己带到屏幕上有打开的Excel工作表以及完成后如何处理它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.