Document OCR and Intelligent Summarization System - n8n Workflow

Use this powerful n8n workflow to automatically process documents from LINE or Gmail, perform OCR using GPT-4o, summarize the content, and archive results in Google Sheets and Gmail drafts.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Professionals who frequently receive critical documents as image attachments (from LINE or email).
Users seeking automated transcription (OCR) and intelligent summarization using advanced AI models like GPT-4o.
Technical users looking for robust n8n templates that seamlessly integrate multiple services (LINE, Gmail, Google Drive, Google Sheets, OpenAI).
Anyone needing a centralized, searchable archive of document summaries created by an efficient n8n workflow.

Overview

Managing documents received through disparate channels like email and messaging apps can be time-consuming. This intelligent document processing system, built as a high-utility n8n workflow, solves this by providing a unified automation pipeline. The core value of this n8n template lies in its ability to standardize input from two distinct n8n trigger points—LINE and Gmail—and subject them to powerful AI analysis. It leverages the Vision capabilities of GPT-4o to accurately perform OCR on images or PDFs, and then generates a concise summary. The result is a fully archived, searchable record in Google Sheets and a detailed reference draft in Gmail, significantly enhancing efficiency and data management within your existing n8n setup.

How it Works

This comprehensive n8n workflow starts with one of two distinct n8n trigger nodes: the LINE Webhook or the Gmail IMAP Trigger.


  1. Trigger & Routing: If triggered by LINE, an 'If' n8n node checks if the message is an image before retrieving the binary data via an HTTP Request. If triggered by Gmail, the attachment is processed directly.

  2. Normalization & Merge: Both paths use 'Set' nodes to tag the source ('LINE' or 'EMAIL') and then merge into a single stream via the 'Merge Triggers' n8n node, ensuring subsequent steps are handled uniformly.

  3. Storage: The binary file is immediately uploaded to Google Drive, which provides a persistent file ID.

  4. OCR Transcription: An HTTP Request downloads the file back from Google Drive. The OpenAI 'Analyze image' n8n node (leveraging GPT-4o-mini) performs OCR, converting the image or PDF content into raw text.

  5. Summarization: After a brief 'Wait' delay (to respect API limits), the raw OCR text is passed to the OpenAI 'Message a model' n8n node, which uses GPT-4o-mini to generate an intelligent, concise summary.

  6. Archiving: The final summary and metadata are logged using the Google Sheets 'Append row in sheet' n8n node. Concurrently, the 'Create Gmail Draft' n8n node compiles a draft containing the original OCR text, the AI summary, and the Google Drive file URL for easy review and follow-up.

Installation Guide

To deploy this powerful n8n workflow, follow these steps:


  1. Import: Copy the provided JSON code and paste it into your n8n instance using the 'New' -> 'Import from JSON' option.

  2. Credentials: You must configure credentials for the following services within your n8n setup:

LINE: For the LINE Webhook and content retrieval.
Gmail: For the Gmail IMAP Trigger and 'Create Gmail Draft' node.
Google Drive: For file uploading and downloading (requires Google OAuth2 API scope).
Google Sheets: For logging summaries.
* OpenAI: For GPT-4o OCR and summarization.

  1. Configuration: Edit the 'Workflow Configuration' n8n node to replace placeholder values (e.g., YOURLINECHANNELACCESSTOKEN, YOURGOOGLEDRIVEFOLDERID).

  2. Google Sheets Setup: Update the 'Append row in sheet' n8n node with your specific Google Sheets Document ID and Sheet Name.

  3. Activation: Once all credentials and configurations are set, activate the n8n workflow to enable automatic document processing via the n8n trigger nodes.

Node Details

LINE Webhook (n8n trigger): Initiates the workflow upon receiving a POST request from the LINE service. Configured with a specific path (line-webhook).
Gmail IMAP Trigger (n8n trigger): Starts the n8n workflow whenever a new email with an attachment arrives in the INBOX. Configured to automatically download attachments.
Upload to Google Drive (n8n node): Takes the incoming binary file and stores it in the specified Google Drive folder, providing a unique file ID for subsequent AI processing.
Analyze image (OpenAI LangChain n8n node): Crucial for the OCR function. Configured to use the gpt-4o-mini model with vision capabilities. The input is provided in base64 format.
Message a model (OpenAI LangChain n8n node): Performs the summarization step. This n8n node uses the transcribed text output from the OCR node to generate a concise summary using gpt-4o-mini.
Append row in sheet (Google Sheets n8n node): Used for logging. It adds a new row containing the AI-generated summary to a designated Google Sheet, creating a permanent log for the n8n workflow execution.


  • Create Gmail Draft (Gmail n8n node): Generates a new draft email. The body dynamically includes the full OCR transcription and the summary, facilitating easy access to the processed information.

Related n8n Workflows

Free

Nodes: 13 Nodes
Updated: December 26 2025
View all
Created by
SOLOVIEVA ANNA
SOLOVIEVA ANNA

Featured*