Free n8n template

AI document data extraction n8n template

What it does

An importable n8n workflow that watches a Google Drive folder, sends each new PDF or image to Claude to classify it and extract every field with its page number and source text, then checks formats and cross-field rules in code. Clean documents land in Airtable as Extracted; the rest are marked Needs review with only the failing fields listed, and a reviewer gets a Slack ping.

What this workflow does

  1. New file in Drive folder (Google Drive Trigger) fires for each file created in the folder you choose.
  2. Download file (Google Drive) fetches the original. Nothing is changed in Drive.
  3. Supported file? (If) lets PDFs and JPEG, PNG, WebP or GIF images through. Anything else goes straight to Slack.
  4. Encode file (Extract from File) converts the file to base64 for the API call.
  5. Build extraction request (Code) sends PDFs as document blocks and images as image blocks, with the field list for each document type.
  6. Extract with Claude (HTTP Request) returns strict JSON: the document type (W-9, certificate of insurance, invoice or other) and, for every field, the value, the page number and the verbatim text it was read from. Missing fields come back as null instead of a guess.
  7. Validate fields (Code) handles refusals, truncated answers and API errors, then checks required fields, date and amount formats, EIN or SSN patterns, and cross-field rules such as expiration after effective date.
  8. Save to Airtable writes every document with status Extracted or Needs review, the failing fields and the full extraction JSON.
  9. Needs review? (If) and Notify reviewer (Slack) ping a reviewer with just the fields to check.

Before you import

  • A current n8n version with Google Drive OAuth access to the intake folder.
  • An Anthropic API key. Extraction uses claude-opus-5-5; for high-volume classification only, claude-haiku-5-5 is cheaper.
  • An Airtable base and a personal access token with write access, and a Slack bot in the review channel.

Setup

  1. Import the JSON and connect the Drive, Anthropic, Airtable and Slack credentials.
  2. Replace REPLACE_WITH_DRIVE_FOLDER_ID, REPLACE_WITH_AIRTABLE_BASE_ID, REPLACE_WITH_AIRTABLE_TABLE_ID and REPLACE_WITH_SLACK_REVIEW_CHANNEL_ID.
  3. In Airtable, create these fields with exactly these names: File name, Drive file ID, Received at, Document type, Status (single select with Extracted and Needs review), Fields needing review, Extracted JSON.
  4. Make a “Review queue” view filtered to Status is Needs review.
  5. Edit DOC_TYPES in Build extraction request and the matching RULES and CROSS checks in Validate fields for your documents.

Test it

Drop four files into the folder: a clean invoice PDF, a phone photo of a certificate of insurance, an expired certificate, and a Word file. Expect one Extracted row, review rows that name only the failing fields, and a Slack message about the unsupported Word file.

Make it production-ready

  • Build a labeled test set of 50 to 100 real documents and measure accuracy per field before trusting straight-through processing.
  • Add the source-text check against the PDF text layer from the guide, using Extract from File’s PDF operation.
  • Split multi-document packets before extraction. One file per document gives far better results.
  • Add an n8n error workflow, and keep the HTTP retries for rate limits on busy days.
  • Store reviewer corrections next to the original value so you can improve prompts and schemas.

Read the full guide on AI document data extraction for schema design and review screens, or get help from Lumeor with SharePoint intake or Postgres as the destination.

Next steps