Save new Gmail attachments to Google Drive folder
Every new email attachment in your Gmail is saved to the Google Drive folder you choose, so your files stay organized and easy to find.
Install it
Set up this Zap for me, read how here: https://zapier.sh/zapier/awesome-zaps/save-new-gmail-attachments-to-google-drive/
Paste into Claude, ChatGPT, Cursor or any agent.
- Category
- Personal Productivity · File management
- Author
- Zapier
- Source
- zapier/awesome-zaps, folder zaps/save-new-gmail-attachments-to-google-drive
Set it up with the CLI
- Add it. Copies the folder into
zaps/save-new-gmail-attachments-to-google-drive/. Outside a project, it makes one first.npx zap-pack add awesome-zaps/save-new-gmail-attachments-to-google-drive - Fill in the values in
config.ts, and in any other file the list marks. Replace each one as its comment and SKILL.md say. - Deploy it. Asks for any value still left, signs you in to Zapier if you aren't, then publishes it to your account.
npx zap-pack deploy save-new-gmail-attachments-to-google-drive - Check it. Its recent runs, with status and errors.
npx zap-pack logs save-new-gmail-attachments-to-google-drive
zaps/save-new-gmail-attachments-to-google-drive/
- README.mdWhat it does, for people
- SKILL.mdHow an agent sets it up: what to ask you, and how to test it
- config.tsIts settings 1 to fill in
- connections/gmail.tsThe
gmailaccount it uses - connections/google-drive.tsThe
google-driveaccount it uses - triggers/new-attachment.tsWhat starts it:
gmailattachment - workflow.tsThe code; each
ctx.stepis a step in the Zap
Agents: add --yes to any command so it never prompts. When it needs an answer only the user can give, it stops and names the flag that supplies it.
SKILL.md
View MarkdownWhat it does
- Trigger: a new email arrives with an attachment (
gmail,attachment). - Google Drive (
google-drive) uploads that attachment to the folder you chose, under its original file name.
The Zap only adds files to Drive. It never changes, labels, moves or deletes emails.
Ask the user
Each REPLACE_… value is set per person. Resolve names to IDs with the user's own connections; don't ask them to paste an ID you can look up.
| Setting | What goes there |
|---|---|
DRIVE_FOLDER_ID |
The Google Drive folder that receives the attachments. Ask which folder it is, then look up its ID (the long ID in its URL). It must exist. |
The trigger watches the whole mailbox by default. If the user wants only some emails saved, set the trigger's label_ids or query (Gmail search syntax) to narrow it, and say so in your summary.
Build it
If you can run shell commands, set it up with zap-pack: run npx zap-pack add awesome-zaps/save-new-gmail-attachments-to-google-drive, replace each REPLACE_… value as this file says, then run npx zap-pack deploy save-new-gmail-attachments-to-google-drive, which signs the user in to Zapier when it gets there. Otherwise build with Zapier MCP, as the steps below say. No Zapier MCP tools? Read https://docs.zapier.com/mcp/get-started/quickstart.md and follow the page for the app you are running in to get the user connected, then continue with this build.
- Accounts: bind
gmailto the user's Gmail connection for the mailbox whose attachments get saved, andgoogle-driveto the Google Drive connection for the account that owns the folder. - Source: publish
workflow.tsandconfig.ts, withDRIVE_FOLDER_IDreplaced by the user's answer.triggers/new-attachment.tsandconnections/are settings, not code: set the workflow's trigger and connection bindings from them. The trigger file names the app by its slug; for the trigger'sselected_api, callsearch_triggerswith that slug, find the row whosekeyisattachment, and use<app_key>@<app_version>from it. - Build guide: load Zapier's build guide with
get_zapier_skill("zapier:build-workflows")and follow it to create, test and publish the workflow. - Fields: inspect the trigger's fields and the Google Drive
file(Upload File) action's fields with the user's connections before the first test run, and fix any key inworkflow.tsthat doesn't match.
Test it
Send a test email with a small file attached to the mailbox, then run this sample as a draft test (run_workflow_draft in Zapier MCP). Use a test email the user sent to themselves, not a real one, and put [install-test] in the name of any test folder.
{
"message_id": "18c0example",
"filename": "test-attachment.pdf",
"attachment": "<URL or file of the test PDF>"
}
Confirm that test-attachment.pdf appears in the destination folder. If run-status tools aren't available, check Google Drive directly. The user deletes the test file, not the agent.
Notes
- Once the Zap is published and its trigger is active, every new attachment that matches the trigger is saved. Narrow the trigger first if the mailbox gets a lot of attachments.
- Files keep the names they arrived with. Two attachments with the same name in one folder both get saved.
- Keep real folder IDs and account names out of any copy you share.