Skip to main content
Question

Filter and Save Attachments from GMail with Python

  • March 10, 2025
  • 1 reply
  • 134 views

Hello All,

I am attempting to create a zap that saves attachments from Gmail into my G drive. One email can have multiple attachments, and I want to filter out the jpg/jpeg attachments. However, the normal filter by zapier does not allow me to do this, so I tried writing a python script to filter out the jpg’s. I then loop through the attachments returned from the python script to save them individually. The problem is that the python code does not return the original attachment file, only a text document of irrelevant data. My question is how do i configure the python code to return to the actual attachments and not text documents? Please see the screenshots below for reference. 

Thank you for your help


 

. 

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

1 reply

Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • March 10, 2025

Hi ​@APS_Masterpiece 

Zap trigger: Gmail - New Attachment

Triggers for each attachment on an email.

Add a Filter with conditions as Zap step 2: https://zapier.com/apps/filter/help