The Zapier loop through line items action is a godsend! For those of us who have been duct-taping together ways to loop through Google Sheets in Zapier, this action finally simplifies the process of looping through line items. Now you can perform tasks in bulk for each row in your sheet easily and quickly so you can get back to the important stuff!
This post will give an overview of the Zapier loop through line items action by using a Google Sheet of customer delivery information to send SMS and email alerts to customers if their order has been shipped. So without further ado let’s take it away!
Get Line Items from Google Sheets
The Customer Database sheet contains the First Name, Order #, Email Address, and Phone Number of each customer along with the Delivery Today? checkbox field to designate whether their order will be delivered today.
As explained in theZapier Google Sheets Quick-Start Guidethere are a few different options for importing data from Google Sheets into Zapier depending on the number of rows or the amount of data that you want to import.
For this example, it is only necessary to import a small number of rows meaning the “Find Many Spreadsheet Rows” action from the Google Sheets app can be used. As shown in the images below, when the “Lookup Column” is set to the “Delivery Today?” column and the “Lookup Value” is set to TRUE then only the rows where this condition is matched will be pulled into the “Rows Col$” fields.
Need to read in more than 10 rows at a time? Explore the different options available in theZapier Google Sheets Quick-Start Guide post so that you can choose the best option and know how to format the imported data correctly so that it can be used in subsequent actions.
Zapier Loop Through Line Items Workflow
Zapier Loop Through Line Items Action
Now that the customer information has been brought in from Step 2. each of the column values can be used in the “Values To Loop” section to form array variables, which we can then loop through. Make sure to select the “Looping by Zapier” app and the “Create Loop From Line Items” action event.
Note the 500 iteration limit that is imposed on the “Maximum Number Of Loop Iterations” field. If you have more than 500 rows to loop through then you will need to use a nested loop (see theZapier For Each Loop Quick-Start Guide).
Once the looping variables have been setup in Step 3, 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 theMarketo SMS Marketing with Telnyx post.
Post Loop Follow Up Actions
You might have been wondering “What if there are actions that I only want to do once after the loop has ended?”.
This is where the “Continue Once Loop Complete” filter comes into play. It uses the “Loop Iteration is Last” boolean value to check if there are any more iterations of the loop to complete. Once this value is true then this filter will allow the Zap to progress to the remaining steps which will be executed once only.
Notice how the content of the email and SMS summary messages is populated using the columns from Step 2 rather than one of the loop variables from Step 3. As shown in the email and SMS inbox images below, this results in one single summary email and SMS being sent containing all the customer information for orders that will be delivered today.
The Zapier loop through line items action is great but there have been 2 big limitations identified while we were working through this post:
Not being able to pull in more than 20 rows from Google Sheets at once
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.
Community-led platform offers networking opportunities, career development tools, and educational resources for more than 3,000 “MO Pros” IRVINE—MarketingOps.com, a new platform for marketing operations professionals, launched today. The website aims to serve the 12 million global professionals in the industry—starting with the 2,800 members of the existing MO Pros community:
Banging your head against the wall because of the 500 iteration limit on the “Looping by Zapier” action? Well make like Freddie Mercury and break free by using webhooks and Python in Zapier to achieve nested looping so that you can do as many iterations as you need!