Skip to main content

What's up Zapficionados! In this "By Zapier" article I'm going to take a look at Looping by Zapier. What it is, how it works, and some examples of how to use it in your workflows. Let's dive in!

What It Is

Looping by Zapier is a helper app to repeat action(s) in your Zaps a variable number of times for sets of values.

Ok, but what does that mean? Let's use an image to illustrate:

a4422c5cc853b93a559e2818d88381f9.png

Here you can see that the Zap has a step that provides 4 line items. Using Looping by Zapier, each one of those line items can run through that first action step and the second action step. It's as though the Zap was triggered 4 separate times, except that iteration is happening within the single Zap.

Hopefully that helps to explain what happens when you start the looping process, but how do you get Zaps to produce data that will work with Looping? 

How It Works

Here are the various ways you can use Looping by Zapier:

g9zflIoEHD0lB4PGVMyoWXiKPoCo401TtSYI01IENiWEvIIVMYvOBoBjIPOztRpGqL6KDC68FONwxcZ-jaf9fo5jJbBQNIrTjSxm1L9guotUYVO4Gl3glw7wO-t66rSuYVh82Uu2=s0

Let's take a look at each of the options:

Create Loop From Text

With this option you can create the line items as follows:

48959056c639819c9dd88b093f10b539.png

I have 3 fields: Name, Age, and City

On the right-hand side, I add the comma-separated values for that item (you can use something other than a comma, as long as you change the Text Delimiter field).

Let's see what we get when we test the step:

eda781913eae741c3e908d111e781976.gif

As expected, we get:

  1. Joan, 34, New York

  2. John, 29, Toronto

  3. Janet, 37, Paris

  4. Jack, 41, London

Create Loop From Line Items

Here, I've already got line items from my trigger step. It's just a matter of mapping them accordingly:

370db44124fc93ced536b833a64e4121.png

When we test it, we see something similar to creating the loop from text:

cfbeb73e667ad83e89865acb2628df6a.png

Create Loop From Numbers

Of all the options, this one is the least obvious in terms of usage, since you don't produce line items that contain information (like the first two options did). 

ae554fbebb62d4e13cd1b77779e5b46c.png

You're essentially creating line items, but the only thing in each one is a number. Based on the screenshot above, you would have 10 line items, with each one being incremented by 1. The starting number is 1. That gives you:

1, 2, 3, 4, 5, 6, 7, 8, 9, 10

You could also do something like this:

d42d53e3054b25d3c647904c2a830d29.png

Again, we start at 1, but this time we go up to 11 and instead of incrementing by 1 each time, we'll do 2. That gives us:

1, 3, 5, 7, 9, 11

My colleague, Clint, wrote an article recently about using Create Loop From Numbers in order to create weekly calendar events. He uses this to loop through Google Sheets rows that are numbered.

Check it out:

What You Can Build With It

In addition to the example above, here are some other ways you could use Looping by Zapier.

Example 1: Looping Through Calendar Attendees to Find and Update Airtable Records

You could trigger on a calendar event, use the attendee emails to perform lookups on each person (in Airtable, for example)

12673f70ccec1911e852aca7f128b265.png

Then you could find the person in Airtable using their email address, and update each person's record with the event name and date.

086ed96a8d0a8f3d519a53e5049eccb3.png

When the the Zap finds an event that matches my search, it will run through each of the attendees, finding their record and then updating it:

9fa6cc8328f9b7b3ff2b9c599cc88433.gif

Example 2: Updating Something (Maybe an Invoice) With Multiple Items sWorkaround]

There may be instances where an app doesn't have the ability to create line items on an object (invoice, estimate, receipt, etc) but does allow you to update that object. You could first create the object, then update it using Looping and add all of the line items that way.

Example 3: Take Action on Each Item of an eCommerce Order

It's quite common for eCommerce platforms to produce orders that contain line items. As it stands now, if you wanted to create one record in Airtable per item, there would be no easy way to do it. With Looping, you simply do something similar to what I showed above, except instead of finding and updating the record, you would simply create it. 

Wrapping Up

If you're looking more resources about Looping by Zapier you can check out the following:

As always, if you've got any questions or would like to tell us about how you're using Looping, please feel free to comment below!

Thank you very much for that great feature - very helpful!
I’m struggling with the text delimiters though, if I try to set it up taking a whitespace.
Is there a way to use a whitespace as delimiter and what do I need to type in there?
I tried it with ‘ ‘, but that didn’t work unfortunately.
Happy about a short answer!


Found out how!
'[:space:]'


Hey @Lucas Rietz! Thanks for updating us on your solution! 🥳


how is this feature counted against task usage?


Is there a way to have 2 Text Delimiters? like an OR statement? 

 


Same question. 

I have a looping by Text that uses a comma with QuickBooks but for some reason at random it will come in with an _ 

 

with an or statement I could add this and then get no errors. Please let me know, Thanks. 


i have a text loop. 7 values hard coded on the loop step. What values are you using in the airtable steps? I am trying to set up something similar with sheets, but not sure if I should be using the ‘preview loop value’ or the named value. 


Hey there folks 👋

@ReduceMyIns, @alennon and @TroyBD - I’m so sorry we missed your messages here previously! I expect you’ve already got these answered but I’ll follow up on each individually in case it’s helpfule for anyone else coming across this thread with similar questions...

@ReduceMyIns: how is this feature counted against task usage?

Since January 2024 Looping by Zapier actions no longer count towards your task usage. See our What does not count toward task usage? guide for the full list of apps that don’t incur any task usage. 🙂

@alennon: Is there a way to have 2 Text Delimiters? like an OR statement? 

There isn’t a way to have more than one text delimiter. Is there instances where a different delimiter is used? If so, perhaps you could use a Formatter (Text > Replace) action to convert the second delimiter to match the first so that when items are passed to the loop they are always interpreted correctly.

@TroyBD: Same question. 

I have a looping by Text that uses a comma with QuickBooks but for some reason at random it will come in with an _ 

with an or statement I could add this and then get no errors. Please let me know, Thanks. 

I’m not entirely sure why the different items from QuickBooks are being separated by commas some of the time and them but perhaps the same approach of using a Formatter (Text > Replace) action to convert the underscore “_” delimiter into a comma instead so that the loop is able to run without error.

 

@coderpad dev: i have a text loop. 7 values hard coded on the loop step. What values are you using in the airtable steps? I am trying to set up something similar with sheets, but not sure if I should be using the ‘preview loop value’ or the named value. 

It’s the named values rather than the preview_loop_values that you’d want to select. For example:
8ad35162f1512c65cd21bca90e064113.png

The preview_loop_values are for preview purposes only and would not appear in actual Zap runs. The reason the named value field only contains a single value is that when testing in the Zap editor you can only run a test for the first loop item. But when the Zap is switched on and runs, it will go through all of the other loops.


Hope that helps to clarify. Do let me know if you have any further questions on this at all! 🙂


Reply