How to run Zapier actions for each email in a Python-parsed list?

Hey folks, I’m stuck with a Zapier automation problem. I’ve got a string with multiple emails from Google Calendar. I need to split this string and trigger a Zapier action for each email separately. I’ve tried a few Python scripts but no luck so far.

Here’s what I attempted:

emails = []
for email in input_data['attendeeEmails'].split():
    emails.append({'Email': email})
return emails

This just returns all emails together, not individually. I also tried:

for email in input_data['attendeeEmails'].split():
    output = {'Email': email}

But I’m not seeing any results from this one.

I’m pretty new to Python and Zapier. The long feedback loop (about 30 minutes) is making it hard to debug. Any ideas on how to make this work? I’d really appreciate some help!

I encountered a similar challenge and found a workaround that might help. Instead of trying to trigger multiple actions from a single Python step, consider using Zapier’s ‘Filter’ step in combination with the ‘Run Python’ step.

First, use your Python code to split the emails and return them as a comma-separated string:

emails = input_data['attendeeEmails'].split()
return {'emails': ','.join(emails)}

Then, add a ‘Filter’ step that uses the ‘Split Text’ function to separate the emails. This creates individual Zap runs for each email. Follow this with your desired action step, which will now run for each email separately.

This approach avoids the need for complex looping and should work within Zapier’s standard functionality. It’s been reliable in my experience and might save you some headaches with the long feedback loop.

I’ve dealt with a similar issue before, and I can share what worked for me. Instead of trying to return multiple emails at once, I found it more effective to use Zapier’s ‘Run Python’ step in combination with a ‘Looping by Zapier’ step.

Here’s the approach:

  1. Use the ‘Run Python’ step to split your email string and format it as a list of dictionaries.
  2. Set up a ‘Looping by Zapier’ step to iterate through this list.
  3. For each iteration, trigger your desired Zapier action.

Your Python code in the ‘Run Python’ step could look like this:

emails = input_data['attendeeEmails'].split()
return {'emails': [{'Email': email} for email in emails]}

This way, you’re passing a properly formatted list to Zapier, which it can then loop through. The long feedback loop is frustrating, I know, but once you get this set up correctly, it should work smoothly. Hope this helps!

yo, i think i got a solution for ya. instead of messin with python, try usin zapier’s built-in stuff. use the ‘formatter’ step to split ur email string, then a ‘path’ step to handle each email separately. way easier than codin it urself n faster to test. lmk if u need more help!