googleworkspace avatar

Recipe Save Email Attachments

A straightforward automation for pulling email attachments into organized Drive storage. Searches Gmail by sender or other criteria, extracts attachment metadata, downloads files locally, then uploads to your specified Drive folder. Saves you from manually downloading dozens of invoices, contracts, or reports one by one. The recipe walks through the four-step process but you'll need to handle the actual looping and error handling. Works well for batch processing client deliverables or archiving financial documents, though you'll want to add filename deduplication if you run it regularly.

skills.sh installs
31.8K
GitHub stars
32.2K
last updated
Aug 21, 2026

Install

$ npx -y skills add googleworkspace/cli --skill recipe-save-email-attachments --agent claude-code

Installs into .claude/skills of the current project.

Files

Save Gmail Attachments to Google Drive

PREREQUISITE: Load the following skills to execute this recipe: gws-gmail, gws-drive

Find Gmail messages with attachments and save them to a Google Drive folder.

Steps

  1. Search for emails with attachments: gws gmail users messages list --params '{"userId": "me", "q": "has:attachment from:client@example.com"}' --format table
  2. Get message details: gws gmail users messages get --params '{"userId": "me", "id": "MESSAGE_ID"}'
  3. Download attachment: gws gmail users messages attachments get --params '{"userId": "me", "messageId": "MESSAGE_ID", "id": "ATTACHMENT_ID"}'
  4. Upload to Drive folder: gws drive +upload --file ./attachment.pdf --parent FOLDER_ID

Sponsors

Details

Repository
github.com/googleworkspace/cli
Categories
CLI & Terminal, Office & Documents

More from googleworkspace/cli

All 113
1googleworkspace avatarrecipe-backup-sheet-as-csvgoogleworkspace/cliExport a Google Sheets spreadsheet as a CSV file for local backup or processing.31.7Kskills.sh installs
2googleworkspace avatarrecipe-organize-drive-foldergoogleworkspace/cliCreate a Google Drive folder structure and move files into the right locations.31.7Kskills.sh installs
3googleworkspace avatarpersona-exec-assistantgoogleworkspace/cliManage an executive's schedule, inbox, and communications.31.6Kskills.sh installs
4googleworkspace avatarrecipe-find-free-timegoogleworkspace/cliQuery Google Calendar free/busy status for multiple users to find a meeting slot.31.5Kskills.sh installs
5googleworkspace avatarrecipe-compare-sheet-tabsgoogleworkspace/cliRead data from two tabs in a Google Sheet to compare and identify differences.31.5Kskills.sh installs
6googleworkspace avatarpersona-content-creatorgoogleworkspace/cliCreate, organize, and distribute content across Workspace.31.5Kskills.sh installs