How to save multiple email attachments individually in Google Drive using Email by Zapier
Hello Zapier Support Team,
I’m setting up an automation using Email by Zapier and have run into a problem.
Here is my workflow:
I have a Google Group email adress that receives messages from partner company (this is not a personal Gmail)
I created a Zapier Email address and added it as a member of that Google group
All incoming emails to this Zaiper address should:
3.1 Save attachments directly to Google Drive
3.2 Automatically convert them to Google Sheets
The issue: when an email contains multiple attachments (for example, three files), Zapier sends them to Google Drive as a single ZIP archive. I would like each attachment to be saved individually with a unique filename, without being compressed into a ZIP.
My request:
Could you please advise how to:
Configure Email by Zapier so that each attachment is uploaded to Google Drive separately
Ensure that the files are saved with unique filenames and dates to avoid overwriting
Avoid the ZIP archive format entirely
I found a similar discussion in the community from a year ago, but Im not sure if the solution is still valid for my case.
Thank you for your help!
Page 1 / 1
Hi @Nadyapest
Why not use Gmail as the Zap trigger.
Zap Trigger: Gmail - New Attachment
Triggers when you receive a new attachment.
Otherwise, you have to use an app that can unzip a ZIP file, to then process each of the files using Looping:
I cant use Gmail as the Zap trigger because this is not my personal Gmail account, I need to process emails coming from a shared Google Group address, forward them to Email by Zapier, and then convert the attachments from these emails into Goggle Sheets and upload them to Google Drive.
Not all emails contain 2-3 attachments that end up in a Zip file - some have only single attachment.
Regarding your suggestion Otherwise, you have to use an app that can unzip a ZIP file, to then process each of the files using Looping - i tried setting up the trigger via the Zip Archive API, but I couldnt get it to work.
Could you please advise on the best way to handle this workflow for mixed cases (some emails with single attachments, others with multiple that end up zipped?)
Thank you!
@Nadyapest
Try this Zap action: ZIP Archive API - Extract ZIP Archive
If you need more help, post screenshots showing how your Zap steps are outlined and configured in EDIT mode with the field mappings visible in the CONFIGURE tab.
The email “A” contains exactly three attachments @Troy Tessalone
@Nadyapest
You need to map data IN to the Looping step then OUT from the Looping step.
In the GDrive step, you have a variable mapped from Zap step 1, but it should be mapped from Zap step 3.
NOTE: Make sure to remove the Extra Fields per the warning in Zap steps.
@Troy Tessalone Thank you for your help!
How I Set Up Automatic Email Attachment Processing in Zapier
The emails come in different formats - sometimes with one attachment, sometimes with multiple attachments, and sometimes with a ZIP archive inside.I wanted the automation to detect what exactly had arrived and handle the files differently depending on the situation.Here’s how I set it up:
Receiving the email
First, I set up Email by Zapier → New Inbound Email. This step catches incoming emails sent to a dedicated Zapier address. As soon as an email arrives, the whole process kicks off.
Preparing the data
Next, I used Formatter by Zapier → Utilities. Here, I converted the list of email attachments into a more convenient format - for example, turning an array into a comma-separated string. This makes it easier to check how many files came in and what their formats are.
Custom code
Then I added Code by Zapier → Run Javascript. Here, I wrote a simple JavaScript snippet that: • extracts file names and extensions; • counts how many attachments were received; • checks if there’s a .zip file; • returns the results for the next step.
Splitting the logic into two scenarios
To process different types of attachments in different ways, I used Paths → Split into paths. This gave me two branches:
Path A - when a ZIP or multiple files arrive • Path conditions: if there’s more than one file or at least one file has the .zip extension. • Zip Archive API → Extract ZIP Archive - if it’s a ZIP, unpack it. • Looping by Zapier → Create Loop From Line Items - loop through each extracted file one by one. • Google Drive → Upload File - upload each file into the target Google Drive folder.The key point: I pass data into the Loop, and then take the specific file out of the Loop for upload. This way, I avoid the issue where only one file gets uploaded.
Path B - when there’s only one non-ZIP file • Path conditions: if there are fewer than two files and none are archives. • Google Drive → Upload File - simply upload this file directly to the correct folder.
Result
Now, whenever an email with attachments comes into my Zapier address, everything happens automatically: • If it’s a ZIP, it’s unpacked and each file is uploaded separately. • If there are multiple files, they’re looped through and uploaded one by one. • If there’s only one non-ZIP file, it’s uploaded straight to Google Drive.
Great work here, @Nadyapest! 🙌 Thanks so much for following up here to share details of how you solved this, it’s super helpful! I’ll go ahead and mark it as the best answer. 🎉
And want to say a big thank you to @Troy Tessalone too, for helping out here 🧡 Hope you both have a great week!