Skip to main content
Best answer

How to loop through BigQuery data to send customized emails with SendGrid


Forum|alt.badge.img

I have a Zap that I want to take data from a BigQuery table that includes rows with unique locations and emails (e.g., a location has one or more fields with emails). I want to grab this information and use it to craft an email based on customer data - for example, if I have a row with a location that is an Office, that row will get an email crafted for Office, I have another for Retail, etc.

I have set up the Zap. It works. But it does not iterate through the rows when I turn it on. One of the use cases is set up as a test user, and the rest are set up as live data with a test email address. I only get the Zap to run for the test use case - I should receive a few dozen emails for all use cases to the test user when it is live, but I do not.

The flow is fairly simple:

  1. Scheduler
  2. Grab the Table from Big Query
  3. Create a Loop with the individual fields identified.
  4. Code a URL based on field data.
  5. Format one of the data points.
  6. ‘Paths’ to identify which email copy to send (they are slightly different based on the location type).

    Everything works well except it does not loop correctly.

    Here is a screen shot:

     

 

Best answer by stubbstarbuckBest answer by stubbstarbuck

That was it - my inbox just exploded with dozens of emails. 

For anyone else reading this topic, when you Create Loop from Line Items, use the “All Rows [Field Name]” and not just the single test case field name from your data set. It will then iterate through the array correctly.

View original
Did this topic help you find an answer to your question?

7 replies

Troy Tessalone
Forum|alt.badge.img+14

Hi ​@stubbstarbuck 

Help links for using the Looping Zap app: https://zapier.com/apps/looping/integrations#help

When testing the Looping Zap step, it will only ever process the first loop iteration.

To test all of the loop iterations, you will need to turn the Zap ON and test live.

 

For us to have more info, post screenshots showing how your Zap steps are configured in EDIT mode with the field mappings visible.


Forum|alt.badge.img

 

 

The Zap is live, but it is only running the test case. It should also have instances that take the other paths. Those Zaps aren’t happening.

 

 


Troy Tessalone
Forum|alt.badge.img+14

@stubbstarbuck 

Each loop iteration will be its own Zap Run in the Zap History: https://zapier.com/app/history/

Which BigQuery action are you using? (screenshots with how the Zap step is configured)

Is that BigQuery action returning line items? (yes/no)


Forum|alt.badge.img

I’m using the Find Row instance. I may switch it to grab it when it runs and eliminate the Scheduler I’m using to test. All of the data is there.


Forum|alt.badge.img

I’m going to test using the array (All Rows) instead of the single preview instance. That is probably the issue.


Forum|alt.badge.img
  • Author
  • Beginner
  • 4 replies
  • Answer
  • February 12, 2025

That was it - my inbox just exploded with dozens of emails. 

For anyone else reading this topic, when you Create Loop from Line Items, use the “All Rows [Field Name]” and not just the single test case field name from your data set. It will then iterate through the array correctly.


ken.a
Forum|alt.badge.img+6
  • Zapier Staff
  • 6324 replies
  • February 13, 2025

That’s awesome ​@stubbstarbuck! A huge thanks to Troy for lending a hand here!

If you have any other questions, please don’t hesitate to reach out to the Community. We’re always happy to help! 🤗