Skip to main content

Extract tracking numbers from Gmail PDF attachments to Google Sheets with okraPDF

Workflow preview

Workflow preview
100%
Extract tracking numbers from Gmail PDF attachments to Google Sheets with okraPDF preview
Open on n8n.io

1. Workflow Overview

Quick Overview This workflow monitors unread Gmail messages with PDF attachments, sends the first PDF to okraPDF for OCR parsing, then extracts likely tracking numbers from the OCR text and appends...

Best for

  • Document Extraction automation workflows
  • AI Summarization automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, n8n-nodes-base.gmailtrigger, n8n-nodes-base.if, n8n-nodes-base.set, n8n-nodes-base.httprequest, n8n-nodes-base.wait, n8n-nodes-base.googlesheets

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by stevent.

Original n8n.io source

1.1 Workflow description

Title
Extract tracking numbers from Gmail PDF attachments to Google Sheets with okraPDF
Workflow name
Extract tracking numbers from Gmail PDF attachments to Google Sheets with okraPDF

Quick Overview

This workflow monitors unread Gmail messages with PDF attachments, sends the first PDF to okraPDF for OCR parsing, then extracts likely tracking numbers from the OCR text and appends the email and parse details as a new row in Google Sheets.

How it works

  1. Triggers every minute when an unread Gmail email arrives that has a PDF attachment, and downloads attachments to the workflow.
  2. Checks that the first downloaded attachment (attachment_0) is a PDF before continuing.
  3. Uploads the PDF to okraPDF and starts an OCR parse job with the configured parser and page settings.
  4. Waits briefly, then polls okraPDF for the job status until it reaches a terminal state.
  5. Extracts tracking-number candidates from the OCR text using a regex and appends a row to Google Sheets with email metadata, parse status, IDs, a text preview, and the raw result JSON.

Setup

  1. Create and connect Gmail OAuth2 credentials with permission to read email and download attachments.
  2. Create and connect an okraPDF API key using HTTP Header Auth, and ensure your okraPDF account can access the /v1/files, /v1/parse, and job status endpoints.
  3. Create and connect Google Sheets OAuth2 credentials, then select the target spreadsheet and sheet (document ID and sheet name) where rows should be appended.
  4. Ensure your destination sheet has columns that match the mapped fields (for example: From, Subject, Attachment, Received At, Tracking Numbers, Status, Job ID, and Text Preview), and adjust the page count/parser values if needed.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Overview

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 2 - Section - Receive

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 3 - Section - Upload & parse

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 4 - Section - Poll & log

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 5 - Gmail Trigger - PDF Attachments

Type / Role
n8n-nodes-base.gmailTrigger - gmailTrigger
Config choices
Version 1.4

Block 6 - IF attachment_0 is PDF

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 7 - Configure OCR Options

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 8 - Upload attachment_0 to okraPDF

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 9 - OCR Parse Uploaded PDF

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 10 - Wait for Parse Result

Type / Role
n8n-nodes-base.wait - wait
Config choices
Version 1.1

Block 11 - Get Job Result

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 12 - If Job Finished?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 13 - Append Tracking Row to Sheets

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.4

3. Summary Table

Workflow Extract tracking numbers from Gmail PDF attachments to Google Sheets with okraPDF
Complexity intermediate
Nodes 13
Categories Document Extraction, AI Summarization
Author stevent
Published 15 Jun 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/16394/16394.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Extract tracking numbers from Gmail PDF attachments to Google Sheets with okraPDF do?

Quick Overview This workflow monitors unread Gmail messages with PDF attachments, sends the first PDF to okraPDF for OCR parsing, then extracts likely tracking numbers from the OCR text and appends...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Document Extraction, AI Summarization use case.