recipe-save-email-attachments

Saves Gmail message attachments to a Google Drive folder using gws CLI commands.

Updated Nov 9, 2023
One-click install
npx skills add https://github.com/oresttokovenko/dot-files --skill recipe-save-email-attachments-oresttokovenko
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: recipe-save-email-attachments
Source: https://github.com/oresttokovenko/dot-files/tree/main/chezmoi/dot_agents/skills/recipe-save-email-attachments
Command: npx skills add https://github.com/oresttokovenko/dot-files --skill recipe-save-email-attachments-oresttokovenko

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Manually downloading email attachments and re-uploading them to cloud storage is repetitive and error-prone. This recipe automates the pipeline of finding Gmail messages with attachments and saving those files directly into a Google Drive folder. ## Core Features & Use Cases - Attachment Discovery: Searches Gmail for messages matching filters like sender and attachment presence using the Gmail API query syntax. - Attachment Download: Retrieves specific attachment data from a message via the Gmail messages attachments endpoint. - Drive Upload: Uploads the downloaded file into a designated Google Drive folder by folder ID. - Use Case: A user receiving monthly invoices from a client can run this recipe to pull every attachment from that sender and archive them in a shared Drive folder without touching the Gmail web UI. ## Quick Start Find all emails from [email protected] that have attachments and save each attachment into my Google Drive invoices folder.

Frequently Asked Questions about recipe-save-email-attachments

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I save Gmail attachments to Google Drive automatically?

Use the gws CLI to search Gmail with a query like has:attachment from:sender, download each attachment via the messages attachments endpoint, then upload the file to Drive with gws drive +upload specifying the target folder ID.

How do I search Gmail for emails with attachments from a specific sender?

Run gws gmail users messages list with a query parameter such as has:attachment from:[email protected]. The command returns matching message IDs that you then pass to the messages get endpoint for details.

What tools are required to run this Gmail to Drive recipe?

The recipe requires the gws binary installed on the system plus two loaded skills: gws-gmail for reading messages and attachments, and gws-drive for uploading files to Google Drive.

Can I upload attachments to a specific Google Drive folder?

Yes, the gws drive +upload command accepts a --parent parameter with the target folder ID. The downloaded attachment file is placed directly into that Drive folder.

Why does the attachment download step return no data?

The attachment ID must come from the message details retrieved via gws gmail users messages get. If the message has no attachment parts or the ID is incorrect, the attachments get call returns nothing.