We get a lot of questions about how to upload email attachments to Dropbox. I thought I’d cover a few of the more common email providers, both with single and multiple attachments.
First up in the series, is Gmail. Here we go!
Single Attachment
With Gmail, there are a few options for triggering your Zap. They fall into two categories.
Trigger: New Attachment
This one triggers specifically on the attachment itself.
This one is pretty straightforward, since you’re provided with a single file, which you can then map to Dropbox like this:
Trigger: New Email/New Email Matching Search/New Labeled Email
These trigger on emails, whether that’s new, matching a search or recently labeled.
For New Email Matching Search, for example, you’d likely want to add something to the Search String field so you can limit the types of emails that will trigger the Zap:
And once again, it’s straightforward to upload the file to Dropbox:
Adding a Filter
If you’d like to ensure that the trigger step only has a single attachment, you can use Filter by Zapier and set it up like this:
NOTE: You don’t have to add this step if you don’t want to. As you’ll see below, we can add Filter/Paths steps later in the Zap to handle multiple attachments.
Adding this particular filter would be if you wanted to do something different/specific when there’s only one attachment. Like, create a Shared Link, for example.
Multiple Attachments
Having more than one attachment means we have to adjust a little.
Trigger: New Email/New Email Matching Search/New Labeled Email
When there are multiple attachments, the Zap is set up in the exact same way
What Happens in Dropbox
This is the fun part! Dropbox (by default) will create a zipped folder that uses the names of the files that are uploaded:
Dropbox has automations!
If you go here in your Dropbox account (https://www.dropbox.com/automations) you can set up an automation that will unzip those auto-zipped folders:
And without you having to do it manually, voila:
Advanced Dropbox Workflow
You may be perfectly happy to have your files in unzipped folders inside of your main folder, as I’ve shown above.
BUT, if you’d like to move the files that are inside that NEW folder, into their parent folder, there’s a way to do it via Zapier.
First, let’s talk through what we’re about to add to our Zap:
- Formatter by Zapier — Line Items to Text: get the individual file names
- Dropbox — Move File: move the first file
From here, we have options:
- We can use a filter step to only continue if the attachment count was greater than 1, 2, 3, etc.
- We can also use Paths to accomplish something similar, instead of multiple Filter steps.
Formatter by Zapier
This step will get us the individual file names from the Gmail step, since they’re given to us like this:
Using the Formatter, we can get them in this format:
Move the First File in Dropbox
Dropbox actually has a neat feature here, where you can specify the path to the file instead of requiring an ID of some sort, which would mean a lot more steps for us.
Here, we use various outputs from our Formatter step to construct the path for the first file:
/my-parent-folder/formatter-output-for-unzipped-folder-in-dropbox/formatter-output-for-file-1
The Filter Method for Additional Files
If you choose to add multiple Filter steps, checking whether there are more files that need moving, you’d set it up like this. You would then use Move File steps after each one, constructing the URLs as shown above for all the subsequent files.
NOTE: if you anticipate receiving X number of attachments in an email, then you should test your Zap with that many attachments so you can run through all the required steps for mapping the file names.
Meaning, if I wanted to create steps for files 3, 4, 5, etc. I won’t have mappable fields as you see above for my 2 files unless I test an email that has that many attachments.
The Path Method for Additional Files
NOTE: Paths are available on the Professional plan and higher. The Starter plan does not have access, which means you would use the Filter method if you’re on the Starter plan.
Much like you would with Filter steps, you would create Path rules that decide whether that Path will run. If you have 5 Paths but only 3 attachments then your rules will stop 2 of those Paths from running.
Here’s an animated GIF to show you the general idea:
Of course, you could set up each step with the appropriate subsequent steps, based on the number of attachments.
Wrapping Up
Hopefully you’ve found this helpful in getting your Gmail attachments into Dropbox If there’s anything that isn’t clear, or that isn’t working for you, please let us know!