Auto-file Gmail attachments into Dropbox folders
Drop new email attachments into the right Dropbox folder automatically, every 15 minutes, with smart routing rules you control.
Build an agent workflow that drains Gmail attachments into the correct Dropbox folder so I never have to drag files around again.
Trigger: cron, every 15 minutes.
On each run, the agent should:
1) Use Gmail List Messages with a query of has:attachment newer_than:1h and a label filter of Unfiled to find new candidate messages.
2) For each message returned, use Gmail Get a Message (format=full) to read the subject, sender, body snippet, and attachment metadata.
3) For each attachment on that message, use Gmail Get Attachment to pull the file content.
4) Decide the right Dropbox destination folder using the routing rules below combined with the agent's own judgement about the email content. Examples I want to start with:
- Email from a known attorney domain with a PDF attached goes to /Contracts.
- Email from a vendor with a PDF that looks like an invoice (mentions invoice number, amount due, bill to) goes to /Finance/Invoices/Incoming.
- Image attachments (PNG, JPG, screenshots) from designer contacts go to /Design/Inbound.
- Anything the agent is not at least reasonably confident about goes to /Inbox/To Sort instead, and the email keeps a Needs Review label rather than getting marked Filed.
5) Use Dropbox Upload File to upload the attachment at the chosen path. Rename the file to {YYYY-MM-DD}-{sender-domain-or-name}-{original-filename}, replacing spaces with hyphens and stripping characters Dropbox does not allow. If a file with the same name already exists, append a short counter rather than overwriting.
6) On successful upload, use Gmail Modify Message Labels to remove the Unfiled label and add a Filed label.
7) If filing fails for any reason (upload error, no confident folder pick, missing label), do not remove the Unfiled label. For low-confidence picks, also add a Needs Review label so I can spot them in Gmail.
Keep a short run summary at the end of each execution: how many messages were checked, how many attachments were filed, the path each one went to, and any messages that ended up in Needs Review with a one-line reason. I want this to be safe to leave running unattended, so it must never overwrite an existing Dropbox file and must never delete or trash a Gmail message.
Additional information
What does this prompt do?
- Checks Gmail every 15 minutes for new messages with attachments that you have not filed yet.
- Reads the subject, sender, and body to decide which Dropbox folder each attachment belongs in.
- Uploads each file to the right folder with a clean, dated filename you can find later.
- Marks the email as filed in Gmail so it never gets processed twice, and parks anything uncertain in a review folder.
What do I need to use this?
- A Gmail account you can sign in to and grant permission to read and label messages.
- A Dropbox account where the files should land.
- A label in Gmail called "Unfiled" applied to the messages you want this agent to handle (you can rename this to whatever you like).
- A rough list of folder rules in your head, for example which senders or document types belong in Contracts, Finance, or Design.
How can I customize it?
- Change the schedule. Every 15 minutes is the default, but hourly or twice a day works just as well if your inbox is calmer.
- Edit the routing rules. Tell the agent which folder pattern fits attorneys, vendors, designers, your accountant, or anyone else you get files from.
- Rename the labels. Swap "Unfiled" and "Filed" for whatever names match your existing Gmail setup.
- Adjust the filename format. The default is date, sender, original name, but you can ask for project codes, client names, or any other prefix.
Frequently asked questions
Will this move files I have already filed manually?
What happens if the agent is not sure which folder a file belongs in?
Can I use folders other than Contracts, Finance, and Design?
Does it handle multiple attachments in one email?
What if the same attachment arrives twice?
Stop dragging files out of Gmail into Dropbox.
Connect Gmail and Dropbox once, describe your folder rules, and let Geni file every new attachment for you.