
Recipe Label And Archive Emails
This is a Gmail automation recipe that searches for emails matching your criteria, slaps a label on them, and archives them in one go. You'd use this to automatically organize recurring emails like notifications, newsletters, or automated reports without manually sorting through your inbox. It's essentially a poor man's Gmail filter built with command-line tools. The three-step process is straightforward: search with a Gmail query, apply your chosen label, then remove the INBOX label to archive. Works well for bulk cleanup operations or when you need more complex matching logic than Gmail's built-in filters provide.
- skills.sh installs
- 31.1K
- GitHub stars
- 32.2K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add googleworkspace/cli --skill recipe-label-and-archive-emails --agent claude-codeInstalls into .claude/skills of the current project.
Files
Label and Archive Gmail Threads
PREREQUISITE: Load the following skills to execute this recipe:
gws-gmail
Apply Gmail labels to matching messages and archive them to keep your inbox clean.
Steps
- Search for matching emails:
gws gmail users messages list --params '{"userId": "me", "q": "from:notifications@service.com"}' --format table - Apply a label:
gws gmail users messages modify --params '{"userId": "me", "id": "MESSAGE_ID"}' --json '{"addLabelIds": ["LABEL_ID"]}' - Archive (remove from inbox):
gws gmail users messages modify --params '{"userId": "me", "id": "MESSAGE_ID"}' --json '{"removeLabelIds": ["INBOX"]}'
Sponsors
Details
- Repository
- github.com/googleworkspace/cli
- Categories
- CLI & Terminal, Office & Documents
More from googleworkspace/cli
All 113- Recipe Reschedule Meeting31.1K
- Recipe Save Email To Doc31.1K
- Recipe Block Focus Time31K
- Recipe Watch Drive Changes31K
- Recipe Create Shared Drive31K
- Persona Team Lead31K
- Recipe Share Doc And Notify30.9K
- Recipe Find Large Files30.9K
- Recipe Create Task List30.9K
- Recipe Schedule Recurring Event30.9K
- Recipe Review Overdue Tasks30.8K
- Recipe Copy Sheet For New Month30.8K
- Recipe Review Meet Participants30.8K
- Recipe Batch Invite To Event30.8K
- Recipe Collect Form Responses30.8K
- Recipe Create Events From Sheet30.7K
- Persona It Admin30.7K
- Recipe Create Vacation Responder30.7K
- Recipe Share Folder With Team30.7K
- Persona Customer Support30.7K
- Recipe Forward Labeled Emails30.7K
- Persona Event Coordinator30.6K
- Gws Modelarmor30.6K
- Persona Sales Ops30.6K