PICKED FROM N8N.IO · DOCUMENTS & DATA ENTRY

When a Gmail message arrives, the workflow reads the text of each PDF attachment and asks OpenAI whether it matches a search term you set, such as invoice or contract. Matching PDFs are uploaded to a chosen Google Drive folder, and the rest are ignored.

Template by n8n Team · 22.1k views on n8n.io · listed there as “Send specific PDF attachments from Gmail to Google Drive using OpenAI”

THE WORKFLOW16 NODES
RRead PDF≡Configure⑂Is PDF–Not a PDF⑂Is matched–This is a matchedPDF–This is not amatched PDF{}Iterate overemail attachmentsOOpenAI matchesPDF textual cont…⋈Merge▲Upload file tofolder@On email received–Ignore large PDFs⑂Is text withintoken limit?⑂Has attachments?–There are noattachments
DIFFICULTY
Intermediate
NODES
16
USES AI
Yes
PUBLISHED
March 2023

001 / WHAT HAPPENS

  1. 01

    A Gmail trigger starts on each new email and checks it has attachments.

  2. 02

    Each attachment is checked to be a PDF and its text is read.

  3. 03

    Large PDFs are skipped if the text is over the token limit.

  4. 04

    OpenAI decides whether the text matches your search term.

  5. 05

    Matching PDFs are uploaded to the Google Drive folder.

WHO IT SUITS

Suits a business that wants invoices, receipts or contracts pulled from a busy inbox into one Drive folder for later processing.

CONNECTS

  • Gmail
  • OpenAI
  • Google Drive

002 / BEFORE YOU USE IT HERE

  • !Customer or staff details sent to an overseas AI provider such as OpenAI is a cross-border disclosure under APP 8 of the Privacy Act, so say so in your privacy policy.
  • !Only PDFs with readable text work, so scanned images are skipped; test with your real attachments.
  • !The workflow uses an older OpenAI node, so check it still works with your current OpenAI account.
  • !Set the search term and folder ID in the Configure node, and check the filter with a few test emails.

WORTH KNOWING

Templates on n8n.io are written for a global audience. Set the workflow timezone to your city, and test with a handful of real items before switching it on.

Need n8n and the AI hosted in Australia? →

004 / QUESTIONS

Anything else is quicker to answer on a call. Thirty minutes, free, with the people who would build it.

Yes. Every template on this list is free on n8n.io. You need an n8n account (n8n Cloud or self-hosted) and accounts for the apps it connects to, some of which charge for API use.

We adapt templates to your systems, add approval steps where customers are involved, host n8n in Australia when the data calls for it and hand it over documented.

Book a free call→