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 Triggers every minute when an unread Gmail email arrives that has a PDF attachment, and downloads attachments to the workflow. Checks that the first downloaded attachment (attachment_0) is a PDF before continuing. Uploads the PDF to okraPDF and starts an OCR parse job with the configured parser and page settings. Waits briefly, then polls okraPDF for the job status until it reaches a terminal state. 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 Create and connect Gmail OAuth2 credentials with permission to read email and download attachments. 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. Create and connect Google Sheets OAuth2 credentials, then select the target spreadsheet and sheet (document ID and sheet name) where rows should be appended. 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.
Related Templates
Extract Title tag and Meta description from url for SEO analysis with Airtable
Extract Title tag and meta description from url for SEO analysis. How it works The workflows takes records from Airtabl...
Restore your workflows from GitHub
This workflow restores all n8n instance workflows from GitHub backups using the n8n API node. It complements the Backup ...
Build a Restaurant Voice Assistant with VAPI and PostgreSQL for Bookings & Orders
This n8n template demonstrates how to create a comprehensive voice-powered restaurant assistant that handles table reser...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments