Automated Filtering and Uploading of Specified PDF Attachments to Google Drive
This workflow can automatically monitor new emails in a Gmail account, intelligently filter email attachments, identify PDF files that match specific keywords, and upload them to a designated Google Drive folder. By leveraging OpenAI's text understanding capabilities, this process not only enhances the accuracy of the filtering but also achieves efficient file management. It is suitable for scenarios such as finance, legal affairs, and administration that require automated processing of email attachments, significantly reducing the burden of manual operations.

Workflow Name
Automated Filtering and Uploading of Specified PDF Attachments to Google Drive
Key Features and Highlights
This workflow automatically monitors new emails in a Gmail inbox and intelligently filters attachments by identifying PDF files that match predefined keywords (e.g., “payslip”). It then uploads the qualifying PDFs to a designated Google Drive folder. The core advantage lies in leveraging OpenAI’s text comprehension capabilities to perform intelligent content matching within PDFs, rather than relying solely on file names or simple rules, significantly enhancing filtering accuracy and automation efficiency.
Core Problem Addressed
In daily work, users often need to filter specific types of PDF files from their email (such as invoices, contracts, payslips), and manually downloading, categorizing, and uploading these files to cloud storage is time-consuming and prone to errors. This workflow automates the entire process, eliminating manual effort and oversight, ensuring timely archiving and management of files.
Use Cases
- Finance personnel automatically collecting and archiving electronic invoices or payslips
- Legal teams organizing contract documents
- Administrative staff archiving various reimbursement receipts
- Any scenario requiring automatic identification and saving of specific PDF attachments
Main Workflow Steps
- Trigger Node (On email received): Monitor Gmail inbox in real-time for new emails and download attachments.
- Configuration Node (Configure): Set keywords (e.g., “payslip”) and specify the target Google Drive folder URL.
- Attachment Check (Has attachments?): Determine if the email contains attachments.
- Attachment Iteration (Iterate over email attachments): Process each attachment individually.
- File Type Check (Is PDF): Filter out non-PDF files.
- Read PDF Text (Read PDF): Extract textual content from the PDF.
- Text Length Check (Is text within token limit?): Control text size to prevent overly long content from affecting AI analysis.
- Intelligent Matching (OpenAI matches PDF textual content): Use OpenAI to analyze the PDF text against the configured keywords.
- Match Decision (Is matched): Determine if the AI result meets the criteria.
- File Upload (Upload file to folder): Upload qualifying PDFs to the specified Google Drive folder.
- Invalid Attachment Handling (NoOp node): Ignore attachments that do not meet criteria or are not PDFs.
Involved Systems and Services
- Gmail: Receive and download email attachments.
- OpenAI: Perform intelligent content-based matching.
- Google Drive: Store qualifying PDF attachments.
- n8n Built-in Nodes: Including PDF reading, conditional checks, and code nodes.
Target Users and Value Proposition
- Enterprises and individuals needing automated management and archiving of email attachments.
- Professionals in finance, legal, administrative departments.
- Tech enthusiasts and organizations aiming to enhance office automation and efficiency through AI integration.
This workflow enables users to effortlessly automate the filtering and archiving of specific PDF files from emails, reducing manual workload and enhancing the intelligence and standardization of file management.