Menu

For Loop Data

Assuming you want to retrieve data from Excel, sequentially visit the Amazon website, scroll down the page, visit the eBay website, scroll down the page, and visit the Walmart website, scroll down the page.

It's recommended to import the following JSON into AdsPower for further learning.

[
  {
    "type": "useExcel",
    "config": {
      "path": "C:\\Users\\snake\\Desktop\\test.xlsx",
      "variableList": [
        "URL"
      ],
      "remark": "",
      "variable": "excel_data"
    }
  },
  {
    "type": "forLists",
    "config": {
      "content": "excel_data",
      "variableIndex": "for_lits_index",
      "variable": "item",
      "children": [
        {
          "type": "extractKey",
          "config": {
            "content": "item",
            "key": "URL",
            "variable": "url_data",
            "remark": ""
          }
        },
        {
          "type": "newPage",
          "config": {}
        },
        {
          "type": "gotoUrl",
          "config": {
            "url": "${url_data}",
            "timeout": 30000,
            "remark": ""
          }
        },
        {
          "type": "waitTime",
          "config": {
            "timeoutType": "randomInterval",
            "timeout": 30000,
            "timeoutMin": 4454,
            "timeoutMax": 5555,
            "remark": ""
          }
        },
        {
          "type": "scrollPage",
          "config": {
            "distance": 3587,
            "type": "smooth",
            "scrollType": "pixel",
            "position": "bottom",
            "remark": ""
          }
        },
        {
          "type": "waitTime",
          "config": {
            "timeoutType": "randomInterval",
            "timeout": 30000,
            "timeoutMin": 2454,
            "timeoutMax": 3121,
            "remark": ""
          }
        }
      ],
      "remark": ""
    }
  }
]

1. Create an Excel file, fill it with the following contents, and save it.

2. Use Import Data from Excel, upload the Excel file you just created, and save it to the variable "excel_data". The data inside Excel will be saved as arrays:

[{"URL":"https://www.amazon.com"},{"URL":"https://www.ebay.com"},{"URL":"https://www.etsy.com"]

 

3. Use For Loop Data to extract data from Excel, and store it to the variable "item"

 

4. Since the item variable is saved as an object, i.e. {"URL": "https://www.amazon.com"} ,it can't be used directly. So, you need to extract "https://www.amazon.com". Therefore, use Extract Field to extract the Key by entering "URL" in the Extract Key box, and save the extracted value to "url_data".

 

Now you are ready to use the extracted data.

Summary of ideas:

 

Previous
Import Data from Excel + Extract Field
Next
For Loop Elements
Last modified: 2024-06-29Powered by