Since all the examples linked to within this post either retrieve data from or manipulate data in Google Sheets, the Zapier Google Sheets Quick-Start Guide will show you the ropes you need to take the reins!
“Looping by Zapier” For Each Loop
The inbuilt “Looping by Zapier” app has three actions that enable you to do up to 500 iterations of all the actions contained within the loop. Unfortunately, Zapier say that the only way to get more than 500 iterations is to contact their support team to get your name added to the feature request so that you will be notified when their engineers release this feature.
Can’t wait that long?
Take a look at the “Code by Zapier” For Each Loop and Nested Zapier For Each Loop sections below to see how you can iterate like its 2008!
“Create Loop From Line Items”
When importing data from Google Sheets using the “Find Many Spreadsheet Rows (With Line Item Support)” action the data is returned in line item format where you get an array for each column in your sheet. The Zapier Loop Through Line Items Example post will show you how to use the “Create Loop from Line Items” action to loop through the row values contained within these arrays.
“Create Loop From Text”
If the values you want to loop through are contained within text variables then you can use the “Create Loop from Text” action, as is done in the Zapier Loop Through Array from Google Sheets post, to split your text variables into arrays of values that you can then iterate through to do things like sending a personalized SMS to each person in a Google Sheet.
“Create Loop From Numbers”
The third and final “Looping by Zapier” action allows you to use a number range to control the iterations of your Zapier for each loop. The Zapier Loop Action post walks you through how to use the “Create Loop From Numbers” action to update rows in a Google Sheet corresponding to the numbers within your custom defined number range.
“Code by Zapier” For Each Loop
Beware though that each Zapier action has a 10 second timeout limit so if your Zapier for each loop code tries to do too many iterations at once and runs for more than 10 seconds then this “Code by Zapier” step will fail.
This is where nested loops in Zapier come in useful because you can put these “Code by Zapier” loops or “Looping by Zapier” actions within an outer loop so you can continue to iterate until all your jobs are complete.
Nested Zapier For Each Loop
Nested loops in Zapier are powerful because they allow you to overcome the 500 iteration limit of the “Looping by Zapier” action or the 10 second timeout limit imposed when looping within “Code by Zapier” actions.
The nested Zapier for each loop is contained within an outer loop formed by a “Catch Webhook” trigger event at the start and a “Send Webhook” action at the end, which passes along the necessary information for the next iteration of the outer loop to continue from where the current iteration finished off.
The Zapier Nested Looping using Webhooks & Python post shows you how to nest a Python loop.
The Zapier Loop Array with Nesting posts shows you how to nest a “Looping by Zapier” action.
Zapier For Each Loop Follow Ups
Now that you know how to create a Zapier for each loop, you are ready to add more tools to your Zapier Swiss army knife! Take a look at the posts below to learn about other Zapier features and see how they can be applied in real-world examples.