Automate Gmail Attachments to Drive & Google Sheets with AI
detail.loadingPreview
Effortlessly capture and organize email attachments by automatically saving them to Google Drive and extracting key data into Google Sheets. Leverage AI to process invoices and other documents with unparalleled accuracy.
About This Workflow
This n8n workflow revolutionizes how you handle email attachments, particularly invoices and important documents. It triggers on new unread emails in Gmail, downloads specified attachments (prioritizing PDFs), and uploads them to a designated Google Drive folder. The workflow then intelligently renames the file and moves it to a specific location. Using AI, it extracts crucial information like invoice date, description, and total price from the PDF and logs this structured data into a Google Sheet, creating a searchable and organized record. Finally, it marks the original email as read to prevent duplicates, streamlining your inbox and document management.
Key Features
- Automatic Attachment Handling: Seamlessly downloads and processes attachments from new, unread Gmail messages.
- Intelligent File Management: Uploads attachments to Google Drive, renames them based on email subject and date, and moves them to organized folders.
- AI-Powered Data Extraction: Utilizes advanced AI (OpenAI) to extract structured data (invoice date, description, total price) from PDF attachments.
- Google Sheets Integration: Appends extracted data to a Google Sheet for easy tracking, reporting, and reconciliation.
- Inbox Organization: Marks processed emails as read, keeping your Gmail inbox clean and manageable.
How To Use
- Connect Services: Set up and authenticate your Gmail, Google Drive, Google Sheets, and OpenAI API credentials within n8n.
- Configure Gmail Trigger: In the 'Gmail Trigger1' node, specify your Gmail account and set the filter to 'unread' status. Ensure 'Download Attachments' is enabled.
- Set Drive Folder ID: In the 'Setup1' node, update the
url_to_drive_foldervalue with the ID of your desired Google Drive folder for uploaded files. - Customize File Naming: Modify the
newUpdatedFileNameparameter in the 'Rename file1' node to define your preferred file naming convention (e.g., using email subject and date). - Define AI Extraction Schema: In the 'Structured Output Parser' node, adjust the
jsonSchemato match the specific data points you want to extract from your attachments (e.g., if you're not processing invoices, update the keys and types accordingly). - Configure Google Sheets Output: In the 'Append to Reconciliation Sheet' node, update the sheet name, worksheet name, and ensure the column headers in the node match the keys defined in your AI extraction schema.
Apps Used
Workflow JSON
{
"id": "f815aa12-94a6-4357-bae7-328a9b8cc08a",
"name": "Automate Gmail Attachments to Drive & Google Sheets with AI",
"nodes": 24,
"category": "Operations",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: f815aa12-94a6...
About the Author
N8N_Community_Pick
Curator
Hand-picked high quality workflows from the global community.
Statistics
Related Workflows
Discover more workflows you might like
Universal CSV to JSON API Converter
Effortlessly transform CSV data into structured JSON with this versatile n8n workflow. Integrate it into any application as a custom API endpoint, supporting various input methods including file uploads and raw text.
Instant WooCommerce Order Notifications via Telegram
When a new order is placed on your WooCommerce store, instantly receive detailed notifications directly to your Telegram chat. Stay on top of your e-commerce operations with real-time alerts, including order specifics and a direct link to view the order.
On-Demand Microsoft SQL Query Execution
This workflow allows you to manually trigger and execute any SQL query against your Microsoft SQL Server database. Perfect for ad-hoc data lookups, administrative tasks, or quick tests, giving you direct control over your database operations.