Skip to main content

Automate invoice data extraction with OCR.Space, GPT & Google Sheets

Workflow preview

Workflow preview
100%
Automate invoice data extraction with OCR.Space, GPT & Google Sheets preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This template automates invoice processing for teams that currently copy data from PDFs into spreadsheets by hand. It is ideal for small businesses, back office teams, accounting, and operations wh...

Best for

  • Invoice Processing automation workflows
  • AI Summarization automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.scheduletrigger, n8n-nodes-base.googledrive, n8n-nodes-base.httprequest, n8n-nodes-base.code, @n8n/n8n-nodes-langchain.openai, n8n-nodes-base.googlesheets, n8n-nodes-base.stickynote

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Automate invoice data extraction with OCR.Space, GPT & Google Sheets
Workflow name
Automate invoice data extraction with OCR.Space, GPT & Google Sheets

Overview

This template automates invoice processing for teams that currently copy data from PDFs into spreadsheets by hand. It is ideal for small businesses, back-office teams, accounting, and operations who want to reduce manual entry, avoid human error, and never miss a payment deadline. The workflow watches a structured Google Drive folder, performs OCR, converts the text into clean structured JSON with an LLM, and appends one row per invoice into Google Sheets. It preserves a link back to the original file for easy review and audit.

  • Designed for small businesses and back-office teams.
  • Eliminates manual typing and reduces errors.
  • Prevents missed due dates by centralizing data.
  • Works with monthly subfolders like "2025年10月分" (meaning "October 2025").
  • Keeps a Google Drive link to each invoice file.

How It Works

The workflow runs on a schedule, scans your Drive folder hierarchy, OCRs the PDFs/images, cleans the text, extracts key fields with an LLM, and appends a row to Google Sheets per invoice. Each step is modular so you can swap services or tweak prompts without breaking the flow.

  • Scheduled trigger runs on a recurring cadence.
  • Scan the parent folder in Google Drive.
  • Auto-detect the current-month folder (e.g., a folder named "2025年10月分" meaning "October 2025").
  • Download PDFs/images from the detected folder.
  • Extract text using the OCR.Space API.
  • Clean noise and normalize with a Code node.
  • Use an OpenAI model to extract invoice_date, due_date, client_name, line items, totals, and bank info to JSON.
  • Append one row per invoice to Google Sheets.

Requirements

Before you start, make sure you have access to the required services and that your Drive is organized into monthly subfolders so the workflow can find the right files.

  • n8n account.
  • Google Drive access.
  • Google Sheets access.
  • OCR.Space API key (set as <your_ocr_api_key>).
  • OpenAI / LLM API credential (e.g., <your_openai_credential_name>).
  • Invoice PDFs organized by month on Google Drive (e.g., folders like "2025年10月分").

Setup Instructions

Import the workflow, replace placeholder credentials and IDs with your own, and enable the schedule. You can also run it manually for testing. The parent-folder query and sheet ID must reflect your environment.

  • Replace <your_google_drive_credential_id> and <your_google_drive_credential_name> with your Google Drive Credential.
  • Adjust the parent folder search query to your invoice repository name.
  • Replace the Sheets document ID <your_google_sheet_id> with your spreadsheet ID.
  • Ensure your OpenAI credential <your_openai_credential_name> is selected.
  • Set your OCR.Space key as <your_ocr_api_key>.
  • Enable the Schedule Trigger after testing.

Customization

This workflow is easily extensible. You can adapt folder naming rules, enrich the spreadsheet schema, and expand the AI prompt to extract custom fields specific to your company. It also works beyond invoices, covering receipts, quotes, or purchase orders with minor changes.

  • Change the monthly folder naming rule such as {{$now.setZone("Asia/Tokyo").format("yyyy年MM月")}}分 to match your convention.
  • Modify or extend Google Sheets column mappings as needed.
  • Tune the AI prompt to extract project codes, owner names, or custom fields.
  • Repurpose for receipts, quotes, or purchase orders.
  • Localize date formats and tax calculation rules to your standards.

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 - Schedule Trigger (Weekly Scan)

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 2 - Get Parent Folder

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 3 - Get Monthly Subfolder

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 4 - List Files

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 5 - Download File (Binary from Drive)

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 6 - OCR (OCR.Space Parsing)

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

Block 7 - Clean OCR Text (Noise Removal)

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 8 - AI Extraction (Generate Structured JSON)

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 1.8

Block 9 - Parse AI Output to JSON

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 10 - Append to Google Sheets

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

Block 11 - Schedule Trigger (Recurring Execution)

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

Block 12 - Google Drive Folder Discovery

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

Block 13 - AI Extraction & Sheets Append

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

Block 14 - OCR Processing (PDF → Text Cleanup)

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

3. Summary Table

Workflow Automate invoice data extraction with OCR.Space, GPT & Google Sheets
Complexity intermediate
Nodes 14
Categories Invoice Processing, AI Summarization
Author Supira Inc.
Published 29 Oct 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/10269/10269.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 Automate invoice data extraction with OCR.Space, GPT & Google Sheets do?

This template automates invoice processing for teams that currently copy data from PDFs into spreadsheets by hand. It is ideal for small businesses, back office teams, accounting, and operations wh...

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 Invoice Processing, AI Summarization use case.