Zapier Loop Through Array from Google Sheets

Have large amounts of data in Google Sheets that you need to loop through but you’re not sure what is the best way import the data and then act on it? Then you’ve come to the right place! This post will show you how to use Zapier to loop through arrays imported from Google Sheets so that you can carry out actions in bulk for each of the array values as shown in the flow diagram below.

On a related note are you interested in learning more about APIs? APIs are the foundational building blocks that power modern software ecosystems like Zapier and the Demystify the API Crash Course will explain the fundamentals and give you a hands-on introduction to making your first API requests. Check out the course using the button below 🙂

Take Tyron’s Course on Demand

Explore the Demystify the API Crash Course

Get Text Arrays from Google Sheets

Flow diagram of the Zapier loop through array workflow
Flow diagram showing how to loop through array values in Zapier

In this post we’ll use the Customer Database Google Sheet to send delivery notifications to customers if their order is scheduled for delivery today. As explained in the Zapier Google Sheets Quick-Start Guide, there are a few different ways to import data from Google Sheets into Zapier as arrays depending on the number of rows or the amount of data you are importing.

For this example, we will use a webhook to send the arrays from Google Sheets to Zapier as explained in the Zapier Import Multiple Rows from Google Sheets post. Then in our zap, we will use the “Catch Hook” trigger to receive the incoming webhook containing the array information.

Customer database Google Sheet with button to send array values to Zapier using a webhook
Customer database Google Sheet with button to send array values to Zapier via webhook
The "Catch Hook" trigger used to receive the webhook from Google Sheets containing the arrays to be looped through in Zapier
Pull in the text arrays from the webhook sent from Google Sheets

Zapier Loop Through Array Workflow

Overview of the Zapier loop through array workflow
Zapier loop through array workflow

Zapier Loop Through Array Action

Once the incoming array information has been received, it can then be used in the “Set up action” section of the “Create Loop from Text” action in the “Looping by Zapier” app. In the “Values To Loop” section, you can create a looping variable for each of your arrays and then specify the “Text Delimiter” so that Zapier can parse out all the array values to loop through.

N.B. One thing to bear in mind is that the maximum number of loop iterations that you can do using this loop through array action is 500. If you have more iterations to do than this then you will need to use nested looping (see the Zapier For Each Loop Quick-Start Guide).

Set up of the Zapier loop through array action
Zapier loop through array action setup

After the “Values to Loop” have been setup, they can then be used in subsequent steps to supply a different value for that variable for each iteration of the loop.

Send Email for Each Array Value

Image showing the body of the outbound email populated with array information
Email body populated with array information

Send SMS for Each Array Value

Image showing the body of the outbound sms populated with array information
SMS populated with array information

If you have not yet gotten yourself set up with Telnyx then take a look at the Marketo 2 Way SMS using Telnyx and Zapier post to see how to get started with sending SMS.

One thing to note about sending SMS is that there are rate limits that apply to certain number types so if you try and exceed these limits, which is very likely when you loop through arrays, then the carrier will throttle the messages and spread them out over a longer timespan to ensure delivery. Therefore, do not expect all your SMS to be delivered right away when looping.

This throttling is implemented to prevent fraudsters and bad actors from easily being able to spam people with large amounts of SMS at once. If higher rate limits are needed you can get verified by your carrier who can then increase your rate limit or allow you to purchase another number type with higher throughput e.g. a short code number. If you want to learn more about rate limits and the pros and cons of the different number types then take a look at the Marketo SMS Marketing with Telnyx post.

Post Loop Subsequent Actions

As shown in the flow diagram in the introduction, you can use a filter to stop looping so that actions after the filter will only run once. This is achieved by checking if the “Loop Iteration is Last” value from the loop through array action in Step 2 is TRUE.

Filter  setup to only allow progression once the Zapier loop through array action has finished
Filter setup to only allow progression once the Zapier loop through array action has finished

Now that the Zap has progressed beyond the filter, a single summary email and SMS can be sent to a customer manager so that they can see all the customers who will receive deliveries today. Notice how the bodies of the email and SMS are using the array values from the webhook in Step 1 instead of the looping variables from Step 2. This is important because we want all the array values to be present in a single message, as shown in the SMS inbox image below.

Summary email populated with array information from Google Sheets
Summary email populated with array information from Google Sheets
Gmail inbox showing the summary email and emails for each array value
Gmail inbox showing the summary email and emails for each array value
Summary SMS populated with array information from Google Sheets
Summary SMS populated with array information from Google Sheets
SMS inbox showing the summary message and messages for each array value
SMS inbox showing the summary message and messages for each array value

What’s Next?

There you have it! That is how you can use Zapier to loop through arrays imported from Google Sheets so that you can carry out actions in bulk for each array value.

This example used the “Create Loop from Text” action from the “Looping by Zapier” app. There are 2 more actions available that you can use for looping: “Create Loop from Line Items” and “Create Loop from Numbers”. These actions are covered, respectively, in the posts below:

If you are interested in nested looping within Zapier then take a look at the Zapier For Each Loop Quick-Start Guide.

About The Author — Tyron Pretorius
Tyron Pretorius

Greetings fellow MO Pros! As a previous mechanical engineer turned marketing operations lead, I now fancy myself as a full-stack marketer capable of designing websites, writing SEO-optimized content, and doing all the tracking and automation on the backend. That being said my bread and butter is marketing operations and I love to get down and dirty with the Marketo API, Python, Zapier, and Google Scripts.

Related free workshops

The New Four Pillars of Marketing Operations

The New Four Pillars of Marketing Operations

Created with the assistance of DALL·E Introduction and Background In 2018, Edward Unthank introduced the four pillars of marketing operations, setting the stage for the management of effective marketing technology (Martech) functions. These pillars have since been the bedrock for many successful careers in marketing operations. My journey to redefine

Become a member
The Role of Front-End Martech Tools in the Age of Generative AI

The Role of Front-End Martech Tools in the Age of Generative AI

Introduction: Blending Human and Technical Perspectives in Martech Caption: Future gardens of martech will blend human and AI perspectives As a co-host of the Humans of Martech podcast, I’ve had the privilege of interviewing some of the brightest minds in marketing technology. This unique experience has provided a blend of

Become a member