Gmail PDF Invoice/Receipt Classifier and Google Drive Uploader (Based on n8n and OpenAI)

This workflow automates the processing of PDF invoices and receipts in Gmail, efficiently identifying and categorizing attachments in emails. Once triggered by a webhook, the system extracts PDF files within a specified date range, uses an AI model to determine their categories, and uploads the qualifying files to a dedicated folder in Google Drive. Additionally, users can choose to email the organized files to relevant personnel, significantly enhancing document management efficiency. It is suitable for businesses and individuals who need to archive and manage financial documents.

Workflow Diagram
Gmail PDF Invoice/Receipt Classifier and Google Drive Uploader (Based on n8n and OpenAI) Workflow diagram

Workflow Name

Gmail PDF Invoice/Receipt Classifier and Google Drive Uploader (Based on n8n and OpenAI)

Key Features and Highlights

This workflow is triggered via a webhook to automatically scan Gmail inbox emails with attachments within a specified date range. It extracts PDF files and leverages OpenAI models to intelligently identify whether these PDFs belong to designated categories (such as invoices or receipts). Qualified PDFs are automatically uploaded to dedicated Google Drive folders named by date. The workflow supports customizable recognition keywords (e.g., “contract”) and optionally allows sending the filtered PDFs via email to specified recipients. With a high degree of automation, it significantly reduces manual effort in filtering and organizing documents.

Core Problems Addressed

  • Automatically identify and classify large volumes of PDF invoices or receipts within Gmail emails, avoiding manual file content review
  • Automatically organize and upload qualifying files to designated cloud folders for easy archiving and subsequent management
  • Optionally batch-send organized files to accountants or relevant personnel, enhancing financial workflow efficiency
  • Improve file filtering accuracy and reduce misclassification through OpenAI’s intelligent text understanding

Use Cases

  • Software development companies or freelancers needing automated classification and archiving of business-related invoices and receipts
  • Finance departments aiming to automatically organize and archive electronic invoices for easier auditing and reimbursement
  • Regularly collecting specific types of PDF files and sending them to accounting staff or outsourced financial service providers
  • Any users relying on Gmail for receiving electronic documents who wish to implement intelligent automated management

Main Workflow Steps

  1. Trigger the workflow via webhook with start/end date and email sending flag parameters
  2. Create a new Google Drive folder named by date (e.g., invoices_YYYY-MM-DD)
  3. Use the Gmail node to retrieve emails with attachments within the specified date range
  4. Filter and extract PDF attachments from each email
  5. Read PDF text content and verify that text length is within the OpenAI model’s token limit
  6. Call the OpenAI GPT-4.1-mini model to determine if the PDF matches preset keywords (default: “invoice or receipt”)
  7. If matched, upload the PDF file to the corresponding Google Drive folder
  8. If email sending is enabled, aggregate all matched PDFs and send them via the Gmail node to designated email addresses

Involved Systems and Services

  • Gmail (email retrieval and sending)
  • Google Drive (automatic folder creation and file upload)
  • OpenAI GPT-4.1-mini model (intelligent PDF content classification)
  • n8n automation platform (workflow orchestration and execution)
  • Webhook (trigger entry point and parameter transmission)

Target Users and Value Proposition

  • Software engineers, finance personnel, and freelancers, helping them efficiently manage and archive invoices and receipts
  • Corporate finance departments, reducing manual handling of electronic vouchers and improving accuracy
  • Accountants and outsourced financial service providers, facilitating centralized access to client documents
  • Any users seeking to enhance document management workflows through intelligent automation technology

This workflow greatly improves the efficiency of processing electronic invoices and receipts. By leveraging AI-powered intelligent recognition, it reduces manual screening errors and serves as an ideal solution for modern office automation.