anaksor-ocr
Sokheng · Kit
Reads Khmer and English text from documents, receipts and photos of signs, using a detector for text lines and a recogniser for each line. Suits developers who…
An n8n workflow that has OpenAI check each PDF attached to new Gmail against a document type you set and uploads matches to Drive.
Gmail PDF attachments matched by AI and saved to Drive is an n8n workflow in the Productivity category, listed by Mindket. It is free. This is version 1, last updated on . Download it on this page or copy its JSON, then import it into an n8n canvas. Nothing runs until you activate it in n8n.
New Gmail message
It starts when Gmail, checked every minute, shows a new message with attachments:
Matching PDFs saved in a Google Drive folder
What you need before you start.
Mailbox
Supplies new messages with their attachments.
NeedsA Gmail credential
Language model
Judges from the file name and text whether a PDF matches the document type.
NeedsAn OpenAI API key
File storage
Receives each matching PDF in the folder you set.
NeedsA Google Drive credential and a folder
Checked by Mindket on 13 Nov 2026
This n8n workflow watches Gmail for mail with PDF attachments. It reads the text of each PDF and asks OpenAI whether the file looks like the kind of document you named, such as an invoice, receipt, contract or payslip. Matching PDFs go to a Google Drive folder. Seventeen nodes run it, beside two sticky notes.
People who receive documents by email and want the right ones filed in a Drive folder for later work. Skip it if you need a guaranteed result, because the model can be wrong, or if the PDFs cannot go to OpenAI.
| Industry | Who uses it | How they use it | Example |
|---|---|---|---|
| Accounting | Bookkeepers | File invoices that arrive by email | A bookkeeper’s inbox sends each supplier invoice to an intake folder. |
| HR | Payroll teams | Collect payslips | A payroll clerk gathers the payslips a provider emails each month. |
| Legal | Paralegals | Pull contracts out of mixed mail | A paralegal finds signed contracts in one folder. |
| Freelance | Freelancers | Keep receipts together | A freelancer saves every receipt for the tax return. |
You need some n8n and a Google account: import a file, add three credentials, name a document type and paste a folder link.
Any n8n that can reach Gmail, OpenAI and Google Drive will run it. The files appear in the Drive folder you choose.
Download saves a zip with workflow.json and Mindket’s setup notes in your downloads folder. Setup takes three credentials, a document type and a folder link.
| Need | Detail |
|---|---|
| n8n | On n8n Cloud or on a server of your own |
| Gmail | A Google account for the mailbox |
| OpenAI | An API key |
| Google Drive | A folder you own, and its link |
workflow.json.Configure, set Match on to the kind of document to keep.<YOUR_FOLDER_ID> with your folder’s id.Activate the workflow. Gmail is checked every minute, and each PDF in a new message is read and judged. A match appears in the Drive folder a little later. Check the folder now and then.
| To change | Where |
|---|---|
| What to look for | Match on in Configure |
| The folder | The link in Configure |
| The size limit and the answer length | maxTokenSize and replyTokenSize |
| The model and the question | The body of OpenAI matches PDF textual content |
A bookkeeper sets Match on to invoice. A supplier writes with an invoice and a brochure attached.
Both are PDFs and both are read. OpenAI answers true for the invoice and false for the brochure, so only the invoice is uploaded to the folder.
If you are new. n8n draws a workflow as boxes joined by lines, and each box, a node, does one job. Here one box splits the attachments, one reads a PDF, one asks the model and one uploads the file. Try it with one invoice first.
For experts. A Code node turns each attachment into its own item. A chat request answers true or false per PDF, and a Merge node puts that answer back beside the file so the upload still has its binary data.
| Node | What it does | What to know |
|---|---|---|
Is text within token limit? | Skips PDFs whose text is too long | It divides the length by four to estimate tokens |
OpenAI matches PDF textual content | Asks Chat Completions for true or false | The reasoning effort is none, so a short answer limit is enough |
Match Result | Trims and lowercases the answer | Is matched accepts only the word true |
Upload file to folder | Saves the PDF to Drive | It takes the folder id from the end of the link |
Each PDF costs one OpenAI call, and a wrong answer can file the wrong document or skip the right one.
gpt-3.5-turbo-instruct. OpenAI’s deprecations page, read on 12 November 2026, lists it as shut down on 28 September 2026. This copy calls Chat Completions with gpt-6-lunamaxTokenSize is 4000, a cautious number, and the model page lists a context of 1,050,000 tokensAn n8n workflow that watches Gmail for new mail with PDF attachments. It reads the text of each PDF and asks OpenAI whether the file looks like the kind of document you named, such as an invoice, receipt, contract or payslip. Matching PDFs go to a Google Drive folder.
workflow.json: the workflow as n8n exports it, nineteen nodes: seventeen that do the work and two sticky notes. It holds no credential.README.md: these notes.OpenAI matches PDF textual content was n8n's older OpenAI text node. The file names no model, so the node used its default, gpt-3.5-turbo-instruct. OpenAI's deprecations page, read on 12 November 2026, lists that model as shut down on 28 September 2026 with gpt-5.6-terra as the replacement. The model page for gpt-5.6-terra shows the legacy Completions endpoint as not supported.gpt-6-luna, sets reasoning_effort to none and takes max_completion_tokens from replyTokenSize. The temperature of 0.1 is gone, because the model page lists no temperature setting.Match Result node follows it. It trims the answer and lowercases it into text, which Merge and Is matched read.https://drive.google.com/drive/folders/<YOUR_FOLDER_ID> now.https://drive.google.com/drive/folders/<id>.workflow.json.On email received.OpenAI matches PDF textual content.Upload file to folder.Configure, set Match on to the kind of document to keep, and replace <YOUR_FOLDER_ID> in the folder link with your folder's id. Leave off anything after the id, such as ?usp=sharing.On email received polls Gmail every minute and downloads attachments, named with the prefix attachment_.Configure holds the settings. Has attachments? stops mail without a file.Iterate over email attachments makes one item per attachment, and Is PDF keeps the files with the extension pdf.Read PDF extracts the text. Is text within token limit? compares the text length divided by four with maxTokenSize minus replyTokenSize, and Ignore large PDFs takes the longer ones.OpenAI matches PDF textual content gets the file name and the text and answers true or false. Match Result cleans the answer up.Merge combines the answer with the PDF, and Is matched passes only a true. Upload file to folder saves the file to the folder named by the link's last part.Match on in Configure.Configure.maxTokenSize and replyTokenSize.OpenAI matches PDF textual content.On email received.true.maxTokenSize is 4000, a cautious number, and the model page for gpt-6-luna lists a context of 1,050,000 tokens, so long PDFs can be allowed by raising it.NOTICE.md 687 B README.md 4 KB workflow.json 12 KB
Sokheng · Kit
Reads Khmer and English text from documents, receipts and photos of signs, using a detector for text lines and a recogniser for each line. Suits developers who…
Qwen · Kit
Qwen2.5-7B-Instruct as GGUF files in eight quantization sizes, to chat with locally through llama.cpp. For people who want a capable 7.6B model on their own co…
ACE-Step · Kit
Generates music from text with a 4B diffusion decoder, 50 steps and guidance control, aiming for higher audio quality than the base. For creators with a GPU of…
op7418 · Skill
Skill that makes single-file HTML slide decks, slide illustrations and platform covers in two visual styles, with a presenter mode for rehearsal. For speakers…
zarazhangrui · Skill
Builds HTML presentations from scratch or from a PowerPoint file and shows visual style previews to pick from, for people who want web slides with no CSS or Ja…
iptv-org · Kit
Collects publicly available live TV channels from many countries into playlists that any video player with live streaming can open. Made for viewers and for de…