从excel工作表复制单元格并将其粘贴到DB查询中
我是新来的西库里人。我需要复制excel工作表中的数据,并使用sikuli脚本将它们粘贴到DB查询中。以及如何在excel单元格之间迭代以重复复制和粘贴数据从excel工作表复制单元格并将其粘贴到DB查询中,excel,automation,sikuli,Excel,Automation,Sikuli,我是新来的西库里人。我需要复制excel工作表中的数据,并使用sikuli脚本将它们粘贴到DB查询中。以及如何在excel单元格之间迭代以重复复制和粘贴数据 这些数据需要一个接一个地复制和粘贴。一次复制所有单元格,然后逐个粘贴可能更容易 一旦Sikuli打开Excel,您可以执行以下操作: type(Key.HOME, KeyModifier.CTRL) #takes you to cell A1 type("a", KeyModifier.CTRL) #select all type("c"
这些数据需要一个接一个地复制和粘贴。一次复制所有单元格,然后逐个粘贴可能更容易 一旦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)
这样做会有帮助吗?一次复制所有单元格,然后逐个粘贴可能更容易 一旦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工作表,以及如何处理它。与其提供具体的方法,不如让我们了解您的选项