Loop Data
You can use this node when you want to iterate through a series of data for use, typically within the scope of the Loop Data
and Stop Loop
nodes. The data will be iterated sequentially if no additional configuration is set in the node.
Access the data list using {{loopData.loopId}}
, where loopId
is a customizable value.
Loop ID
The ID to identify the loop. Use this ID when you want to access loop data within an expression or fill it in the Stop Loop node.
Loop through
Table
Iterate through the data of a column in a table
Example
You will use the Loop Data
node to iterate through the values in the age
column.
First, to iterate through the data in the column, you need to create columns in the table. Here you will create two columns: age
and name
.
Next, you will insert data into those columns using the Insert Data
node.
Then, you will configure the Loop Data
node with the option to iterate by Table
.
Next, to retrieve the data for each iteration corresponding to the age
column, you will use the expression {{loopData.ZRGdfk.age}}
in the Press Key
node to output that value.
Finally, you will run the process to retrieve the values in the age
column for each iteration.
Numbers
Repeat an action or value using the selected counter.
Example
You will use the Loop Data
node to iterate through values using the counter
from 1
to 2
. First, you will configure the Loop Data
node with the option to iterate by counter, selecting to iterate from 1 to 2, meaning, you will loop 2 times.
Calculating the number of iterations is simple. For example, iterating from 3
to 5
results in 3 iterations, calculated as (5-3)+1. Similarly, iterating from 2
to 6
results in (6-2)+1=5 iterations.
Next, configure the Press Key
node to type the text 123
for each iteration.
Finally, you will run this process.
Google Sheets
Iterate through data retrieved from the Google Sheets node. Each iteration retrieves data from a row in Google Sheets
.
- Connection Key: The key to connect to the
Google Sheets
node. This key name must match theReference Key (optional)
in theGoogle Sheets
node.
Example when using multiple random data in multiple iterations
You will use this in a process to comment multiple times on a video on YouTube
.
First, you will prepare a data sheet on Google Sheets
as follows:
Next, to retrieve data from Google Sheets
, you will configure the Google Sheets
node as follows:
Then, you will configure the Loop Data
node with the option to iterate by Google Sheets
. Here, you want to iterate twice to retrieve data, so you will set 2
in the Maximum number of iterations
field. You also want to retrieve data randomly, so you will select Random iteration order
.
Next, you will configure the Click element
node to click on the comment section.
Then, configure the Press Key
node with an expression to retrieve the value from the cmt
column for each iteration. Here you will use the expression {{loopData.com.cmt}}
. Since you have already clicked on the comment section, you don’t need to specify a selector in this node.
Next, configure the Click element
node to click the Comment
button to post the typed comment.
Then, you will add a Delay
node for 1 second to continue commenting a second time.
Finally, you will configure the Stop Loop
node, where you will enter the same ID as in the Loop Data
node.
The node cluster will look like this:
When configuring the node cluster like this, the process will run from the Google Sheets
node to the Loop Data
node. After executing the series of nodes from Click element
to the Delay
node, the workflow will repeat based on the number specified in the Maximum number of iterations
field. The process repeats the nodes between Loop Data
and Stop Loop
for the specified number of iterations.
When running, the process will comment twice as desired.
Spreadsheet
Iterate through data retrieved from an Excel data file.
Example when retrieving multiple random values
You will use the Loop Data
node to retrieve random data from the fName
and lName
columns from an Excel file for use in the account registration process on w3schools
. You want the first name and last name to be retrieved randomly from a file.
First, you will prepare an Excel data file as follows:
Next, to retrieve data from the fName
column in that Excel file, you will configure the Spreadsheet
node as follows:
Then, you will configure the Loop Data
node with the option to iterate by Spreadsheet
.
Next, configure the Press Key
node with an expression to retrieve the value from the fName
column for each iteration. Here you will use the expression {{loopData.fname.fName}}
.
Finally, you will configure the Stop Loop
node, where you will enter the same ID as in the Loop Data
node, and since you only want to input the value once and then exit the loop, you will check the Stop loop
box.
Next, to retrieve data from the lName
column in that Excel file, you will configure the Spreadsheet
node as follows:
Then, you will configure the Loop Data
node with the option to iterate by Spreadsheet
.
Next, configure the Press Key
node with an expression to retrieve the value from the lName
column for each iteration. Here you will use the expression {{loopData.lName.ho}}
.
Finally, you will configure the Stop Loop
node, where you will enter the same ID as in the Loop Data
node, and since you only want to input the value once and then exit the loop, you will check the Stop loop
box.
The node cluster will look like this:
When running, the process has filled in random values from the ho
and ten
columns into the corresponding fields.
Variable
Iterate through the values of a variable when the variable is an array type.
Example
Here you want to randomly comment multiple times on a video on YouTube
.
First, you will prepare a text file containing the list of comments, you want to use.
Next, you will configure the Read File Text
node to retrieve the data and assign it to the cmt
variable.
Then, in the Loop Data
node, you will configure it to iterate over the cmt
variable, select Random iteration order
to retrieve random values from the variable for each iteration, and set Maximum number of iterations
to 2 to use the data twice.
Next, you will configure the Click element
node to click on the comment section.
Then, you will configure the Press Key
node to input the data retrieved for each iteration into the comment section using the expression {{loopData.cmt}}
. In this node, you don’t need to configure a selector since the Click element
node has already clicked on the comment section.
Next, configure the Click element
node to comment the typed text.
Then, add a Delay
node to pause for 1 second before continuing to comment again.
Finally, the Stop Loop
node. The node cluster will look like this:
When running the node cluster, the process has commented twice with random text each time.
Custom Data
When you select custom data, ensure that, you write it in the form of an array of data using JSON syntax.
Example using the Loop Data
node to iterate through Custom Data
First, you will configure the Loop Data
node with the option to iterate through Custom Data
.
Next, you will input data by clicking the Insert Data
button, which will display a table. You need to paste the data, you want to iterate into that table. Note that the data must be in array format. For example, you want to insert this data array:
["one", "two", 3, 4, { "name": "an" }]
Then setup node Press key
to write data json
above
Finally, the node cluster will look like this
have been output
Elements
When you select the Loop data
with Elements
option, this node will iterate through each element with a CSS Selector
matching the CSS Selector
you input.
Example
Here you want to scrape the titles of videos available on a channel.
First, you will configure the Loop Data
node with the option to iterate through Elements
. To retrieve the titles of those videosyou need to input the common selector for the elements containing the video titles. Then, configure the number of titles to retrieve in the Max data to loop
field. You want to retrieve the first 2 titles sequentially, so you will not configure Random iteration order
.
Next, to retrieve the titles, you will use the Get Text
node to extract the text from each iterated element. In this node, instead of inputting the selector for the element containing the title, you only need to input the general expression {{loopData.vid}}
, which represents the element being iterated. Then, insert the retrieved value into the title
column created earlier. Each retrieved value will be inserted into a row in the column.
Then, you will use the Loop breakpoint
node to end the iteration here. The process will repeat the Export Data
node until it completes the 2 iterations you configured.
Finally, you will configure the Export Data
node to export the data inserted into the column to a file.
The node cluster will look like this:
When running this node cluster, the result you get is the list of retrieved titles.
The result in the file will be as follows:
Max data to loop (0 is loop all data)
Customize the maximum number of data items to iterate. The default is 0, which iterates through all data.
Start from index
Iterate from position 0, corresponding to the first position of the data in a list.
Reverse loop order
Iterate from the last element to the first element in the data list.
Random loop order
Retrieve an element in random order from the list.
Note
Ensure the page does not reload when using this node, otherwise the node will encounter an error.