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.
Get Text Arrays from Google Sheets
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 Sheetspost. Then in our zap, we will use the “Catch Hook” trigger to receive the incoming webhook containing the array information.
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).
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.
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 Telnyxpost.
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.
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.
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:
Greetings fellow MOPs 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.
Integrating Google Sheets with Zapier will allow you to unlock a whole new array of automation possibilities for the data in your spreadsheets. This post will show you how to use Zapier with Google Sheets by walking through the 3 different options for importing data into Zapier using the Google Sheets app.
When trying to pull a specific row from your Google Sheet into Zapier you can use a lookup value dynamically populated with a variable from a previous step. This is useful but the real power of using the Google Sheets lookup value in Zapier comes when you need to import large amounts of data into your zap.