菜单

导入Excel素材、字段提取

场景:

从Excel中获取数据,获取Excel的信息,如:【URL】列的 "http://www.amazon.com " ,【keyword】列的 " apple "。然后,访问 http://www.amazon.com, 在亚马逊搜索框输入 apple 。

 

建议:

请将以下RPA流程JSON导入到AdsPower中。案例讲解主要的步骤与思路,其他步骤请自行研究。

[ { "type": "useExcel", "config": { "path": "C:\\Users\\snake\\Desktop\\RPA.xlsx", "variableList": [ "URL", "keyword" ], "remark": "Change to your excel file", "variable": "excel_data" } }, { "type": "extractKey", "config": { "content": "excel_data", "key": "0", "variable": "line1", "remark": "Extract the data in row 1" } }, { "type": "extractKey", "config": { "content": "line1", "key": "URL", "variable": "url1", "remark": "Extract data in column URL" } }, { "type": "extractKey", "config": { "content": "line1", "key": "keyword", "variable": "key_data", "remark": "Extract data in column keyword" } }, { "type": "saveData", "config": { "name": "test", "template": "Excel的数据:\n${excel_data}\n\n第1行的数据:\n${line1}\n\n第1行URL的数据:\n${url1}\n\n第1行keyword列的数据:\n${keyword}", "remark": "" } }, { "type": "newPage", "config": {} }, { "type": "gotoUrl", "config": { "url": "${url1}", "timeout": 30000, "remark": "" } }, { "type": "waitTime", "config": { "timeoutType": "randomInterval", "timeout": 30000, "timeoutMin": 5414, "timeoutMax": 5555, "remark": "" } }, { "type": "inputContent", "config": { "selector": "#twotabsearchtextbox", "serialType": "fixedValue", "selectorType": "selector", "element": "", "serial": 1, "serialMin": 1, "serialMax": 50, "intervals": 300, "content": "", "isRandom": "1", "randomContent": "${keyword1}", "remark": "" } }, { "type": "screenshotPage", "config": { "name": "", "path": "", "quality": 50, "format": "png", "fullPage": "0", "remark": "" } } ]
 
 
使用说明:

第1步:如图所示,创建1个excel文件,填充内容,并保存。

 

第2步:使用【导入Excel素材】导入上一步创建的excel,将其存为变量excel_data。excel里面的数据会以数组的形式存到变量excel_data。如:

[{"URL":"https://www.amazon.com","keyword":"apple"},

{"URL":"https://www.ebay.com","keyword":"watch"},

{"URL":"https://www.etsy.com","keyword":"gundam"}]

 

第3步:利用【字段提取】,从变量“excel_data”里面,提取第1行的数据,存到变量 line1。由 数组与对象 得知,数组的第1个元素的下标是【0】,所以key的值填0。如果要提取第2行的数据,key的值是1。提取第3行的数据,key的值是2。

 

第4步:第1行的数据已经提取到,但是依然无法使用,因为它长这样:{"URL":"https://www.amazon.com","keyword":"apple"}。我们需要继续提取数据:https://www.amazon.com,apple。

继续使用【字段提取】,数据选:line1。提取key填 URL,因为对象是以键值对的形式存储数据的。

 

第5步:通过上面4个步骤,我们终于拿到excel里面的数据。其余步骤,您可以自行研究。

 

思路总结:

 

上一个
导入txt、随机提取
下一个
For循环数据
最近修改: 2024-06-20Powered by