Use this powerful n8n workflow to automatically process scanned invoices from Google Drive using OCR.space and OpenAI/LLM for structured data extraction into Google Sheets.
Download this n8n workflow template and start using it instantly.
Accounting Teams: Automating tedious data entry from thousands of invoices.
Small Businesses & Freelancers: Needing a cost-effective system to digitize expenses.
n8n Automation Developers: Seeking advanced examples of using conditional logic, OCR, and LLMs within a single n8n workflow.
Users of n8n: Looking for a practical, real-world application utilizing multiple n8n node types.
Handling large volumes of scanned documents, such as invoices, is a time-consuming administrative burden. This sophisticated n8n workflow solves this by creating a fully automated pipeline. It monitors a Google Drive folder for new files, intelligently routes them based on file type (image or PDF), performs optical character recognition (OCR) where necessary, and then uses a powerful large language model (LLM) via the specialized n8n node for LangChain to extract key structured data (company name, total, invoice number). The final extracted data is cleanly organized and appended to a Google Sheet, providing an exceptional example of what is possible with advanced n8n templates. This entire process is driven by the robust Google Drive n8n trigger, ensuring real-time processing of new documents.
This n8n workflow operates in two main modes: a manual batch execution for existing files, and an automated execution driven by the Google Drive n8n trigger.
Check for new invoices n8n trigger starts the process when a new file appears in the designated Google Drive folder. The file is then downloaded using a Google Drive n8n node.Loop Over Items node processes each document individually, and the Set file identity n8n node saves crucial metadata (ID, name) for later referencing.Switch Mime Type node determines if the file is an image (image/) or a PDF (application/pdf).Extract from File n8n node to pull text directly. The Identify CamScanner condition checks if the resulting text is corrupted or if the PDF metadata indicates poor quality (like those from CamScanner). If the PDF quality is poor, the document is rerouted to the OCR path.Analyze Image (HTTP Request) n8n node, which connects to the OCR.Space API. This node reads the image and returns recognized text.Information Extractor n8n node. This node, using an underlying OpenAI Chat Model, is configured to parse the unstructured text and reliably output structured JSON containing the company name, total, date, and invoice number.Append row in sheet n8n node takes the structured data and logs a new row in the specified Google Sheet, including a direct link back to the source file using the stored file ID. This complete n8n workflow ensures data accuracy and streamlined financial record-keeping.To install this robust n8n workflow, follow these steps:
Check for new invoices) and Google Drive n8n node (Download file and Fetch 50 docs) credentials. Specify the ID of the Google Drive folder where invoices are uploaded.Analyze Image) to connect to the OCR.Space API, providing your API key as a header authentication.OpenAI Chat Model credential is configured with your OpenAI API key.Append row in sheet) credentials. Specify the Document ID and Sheet Name where the extracted data should be stored.This n8n template relies on a combination of built-in and integration-specific nodes:
Google Drive Trigger (Check for new invoices): The primary n8n trigger, polling the 'Scanned invoices' folder for new file additions, initiating the automated data pipeline.
Google Drive Node (Download file): Downloads the file contents based on the file ID provided by the trigger.
Switch Node (Switch Mime Type): This core control flow n8n node determines the document type (image or PDF) to route processing correctly.
Extract From File Node (Extract from File): Attempts to extract readable text directly from PDF documents before resorting to external OCR services.
If Node (Identify CamScanner): A crucial conditional n8n node that checks PDF quality. If poor, it reroutes the file to the more reliable image OCR path.
HTTP Request Node (Analyze Image): Sends image files or poorly extracted PDFs to OCR.Space for character recognition, configured to use Engine 2 for better accuracy.
LangChain Information Extractor Node: This powerful n8n node utilizes the connected OpenAI Chat Model to perform structured data extraction based on defined attributes (company name, total, currency, etc.) from the raw text provided. This is a key feature of this advanced n8n workflow.
Google Sheets Node (Append row in sheet): The final step of the n8n workflow, taking the structured data and writing it to the spreadsheet, completing the automation cycle.
Use this robust n8n workflow to automate sales invoice generation. It validates CSV data, calculates totals, leverages n8n Data tables for storage, and handles errors automatically.

Use this robust n8n workflow to automate HR tasks. It watches Google Drive for new resumes, uses GPT-4o for data extraction, saves structured data to Google Sheets, and automatically creates hiring tasks in ClickUp. A prime example of effective n8n templates.

Use this advanced n8n workflow to automatically process receipt photos sent via Telegram using Google Vision OCR and OpenRouter LLMs, structuring and saving financial data to Google Sheets.

Automate Shopify lead processing using this advanced n8n workflow. It monitors Gmail, extracts lead data via regex parsing, and automatically creates or updates HubSpot Contacts and Deals.

Use this comprehensive n8n workflow to automate new Shopify order fulfillment: automatically update Zoho CRM, generate Harvest invoices, create Trello tasks, and send segmented customer emails using the powerful n8n node structure.

Use this robust n8n workflow to reliably capture full Telegram media groups (image albums), utilize an n8n Data Table for message queuing and stability, and process the resulting images and text via NanoBanana (Gemini) multimodal AI through the OpenRouter API.

I save my customers huge amounts of time and money by designing and delivering AI automations and AI-powered applications. With over 20 years in technical and management roles, I’ve led teams, launched products, and steered complex projects across industries and technologies. If you’re looking to harness AI for real business impact - not just experimentation - let’s connect.







































