Skip to main content

Extract data from Thai Government letters with Mistral OCR and store in Google Sheets

Workflow preview

Workflow preview
100%
Extract data from Thai Government letters with Mistral OCR and store in 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

LINE OCR Workflow to Extract and Save Thai Government Letters to Google Sheets This template automates the extraction of structured data from Thai government letters received via LINE or uploaded t...

Best for

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

Tools used

n8n-nodes-base.stickynote, n8n-nodes-base.webhook, n8n-nodes-base.httprequest, n8n-nodes-base.set, n8n-nodes-base.googledrivetrigger, n8n-nodes-base.googledrive, n8n-nodes-base.merge, n8n-nodes-base.if

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Extract data from Thai Government letters with Mistral OCR and store in Google Sheets
Workflow name
Extract data from Thai Government letters with Mistral OCR and store in Google Sheets

LINE OCR Workflow to Extract and Save Thai Government Letters to Google Sheets

This template automates the extraction of structured data from Thai government letters received via LINE or uploaded to Google Drive. It uses Mistral AI for OCR and OpenAI for information extraction, saving results to a Google Sheet.


Who’s it for?

  • Thai government agencies or teams receiving official documents via LINE or Google Drive
  • Automation developers working with document intake and OCR
  • Anyone needing to extract fields from Thai scanned letters and store structured info

What it does

This n8n workflow:

  1. Receives documents from two sources:
    • LINE webhook (via Messaging API)
    • Google Drive (new file trigger)
  2. Checks file type (PDF or image)
  3. Runs OCR with Mistral AI (Document or Image model)
  4. Uses OpenAI to extract key metadata such as:
    • book_id
    • subject
    • recipient (to)
    • signatory
    • date, contact info, etc.
  5. Stores structured data in Google Sheets
  6. Replies to LINE user with extracted info or moves files into archive folders (Drive)

How to Set It Up

  1. Create a Google Sheet with a tab named data and the following columns Example Google Sheet:
    • book_id, date, subject, to, attach, detail, signed_by, signed_by_position, contact_phone, contact_email, download_url
  2. Set up required credentials:
    • googleDriveOAuth2Api
    • googleSheetsOAuth2Api
    • httpHeaderAuth for LINE Messaging API
    • openAiApi
    • mistralCloudApi
  3. Define environment variables:
    • LINE_CHANNEL_ACCESS_TOKEN
    • GDRIVE_INVOICE_FOLDER_ID
    • GSHEET_ID
    • MISTRAL_API_KEY
  4. Deploy webhook to receive files from LINE Messaging API (Path: /line-invoice)
  5. Monitor Drive uploads using Google Drive Trigger

How to Customize the Workflow

  • Adjust the information extraction schema in the OpenAI Information Extractor node to match your document layout
  • Add logic for different document types if you have more than one format
  • Modify the LINE Reply message format or use Flex Message
  • Update the Move File node if you want to archive to a different folder

Requirements

  • n8n self-hosted or cloud instance
  • Google account with access to Drive and Sheets
  • LINE Developer Account
  • OpenAI API key
  • Mistral Cloud API key

Notes

  • Community nodes used: @n8n/n8n-nodes-base.mistralAi
  • This workflow supports both document images and PDF files
  • File handling is done dynamically via MIME type

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 - Sticky Note

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

Block 2 - LINE Webhook

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

Block 3 - Sticky Note1

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

Block 4 - Get Line File

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

Block 5 - Set Line Data

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

Block 6 - Sticky Note2

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

Block 7 - Google Drive Trigger

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

Block 8 - Sticky Note3

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

Block 9 - Download File (Drive)

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

Block 10 - Merge Data Sources

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 2.1

Block 11 - Sticky Note4

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

Block 12 - Check File Type

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

Block 13 - Sticky Note5

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

Block 14 - Sticky Note6

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

Block 15 - Sticky Note7

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

Block 16 - Sticky Note8

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

Block 17 - Write to Google Sheet

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

Block 18 - Sticky Note9

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

Block 19 - Reply to LINE

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

Block 20 - Sticky Note10

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

Block 21 - Check Source for Reply

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

Block 22 - Information Extractor

Type / Role
@n8n/n8n-nodes-langchain.informationExtractor - informationExtractor
Config choices
Version 1.2

Block 23 - OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 24 - Set Drive Data

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

Showing the first 24 of 29 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Extract data from Thai Government letters with Mistral OCR and store in Google Sheets
Complexity advanced
Nodes 29
Categories Document Extraction, AI Summarization
Author Jaruphat J.
Published 30 Jul 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/6702/6702.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 data from Thai Government letters with Mistral OCR and store in Google Sheets do?

LINE OCR Workflow to Extract and Save Thai Government Letters to Google Sheets This template automates the extraction of structured data from Thai government letters received via LINE or uploaded t...

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.