Skip to main content

Extract and structure Thai documents to Google Sheets using Typhoon OCR and Llama 3.1

Workflow preview

Workflow preview
100%
Extract and structure Thai documents to Google Sheets using Typhoon OCR and Llama 3.1 preview
Open on n8n.io

Important notice

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

1. Workflow Overview

️ Note: This template requires a community node and works only on self hosted n8n installations. It uses the Typhoon OCR Python package and custom command execut...

Best for

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

Tools used

n8n-nodes-base.manualtrigger, @n8n/n8n-nodes-langchain.lmchatopenrouter, n8n-nodes-base.executecommand, @n8n/n8n-nodes-langchain.chainllm, n8n-nodes-base.code, n8n-nodes-base.googlesheets, n8n-nodes-base.readwritefile, 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 Jaruphat J..

Original n8n.io source

1.1 Workflow description

Title
Extract and structure Thai documents to Google Sheets using Typhoon OCR and Llama 3.1
Workflow name
Extract and structure Thai documents to Google Sheets using Typhoon OCR and Llama 3.1

⚠️ Note: This template requires a community node and works only on self-hosted n8n installations. It uses the Typhoon OCR Python package and custom command execution. Make sure to install required dependencies locally.


Who is this for?

This template is for developers, operations teams, and automation builders in Thailand (or any Thai-speaking environment) who regularly process PDFs or scanned documents in Thai and want to extract structured text into a Google Sheet.

It is ideal for:

  • Local government document processing
  • Thai-language enterprise paperwork
  • AI automation pipelines requiring Thai OCR

What problem does this solve?

Typhoon OCR is one of the most accurate OCR tools for Thai text. However, integrating it into an end-to-end workflow usually requires manual scripting and data wrangling.

This template solves that by:

  • Running Typhoon OCR on PDF files
  • Using AI to extract structured data fields
  • Automatically storing results in Google Sheets

What this workflow does

  1. Trigger: Run manually or from any automation source
  2. Read Files: Load local PDF files from a doc/ folder
  3. Execute Command: Run Typhoon OCR on each file using a Python command
  4. LLM Extraction: Send the OCR markdown to an AI model (e.g., GPT-4 or OpenRouter) to extract fields
  5. Code Node: Parse the LLM output as JSON
  6. Google Sheets: Append structured data into a spreadsheet

Setup

1. Install Requirements

  • Python 3.10+
  • typhoon-ocr: pip install typhoon-ocr
  • Install Poppler and add to system PATH (needed for pdftoppm, pdfinfo)

2. Create folders

  • Create a folder called doc in the same directory where n8n runs (or mount it via Docker)

3. Google Sheet

Create a Google Sheet with the following column headers:

book_id date subject detail signed_by signed_by2 contact download_url

You can use this example Google Sheet as a reference.

4. API Key

Export your TYPHOON_OCR_API_KEY and OPENAI_API_KEY in your environment (or set inside the command string in Execute Command node).


How to customize this workflow

  • Replace the LLM provider in the Basic LLM Chain node (currently supports OpenRouter)
  • Change output fields to match your data structure (adjust the prompt and Google Sheet headers)
  • Add trigger nodes (e.g., Dropbox Upload, Webhook) to automate input

About Typhoon OCR

Typhoon is a multilingual LLM and toolkit optimized for Thai NLP. It includes typhoon-ocr, a Python OCR library designed for Thai-centric documents. It is open-source, highly accurate, and works well in automation pipelines. Perfect for government paperwork, PDF reports, and multilingual documents in Southeast Asia.


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 - When clicking ‘Test workflow’

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

Block 2 - OpenRouter Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenRouter - lmChatOpenRouter
Config choices
Version 1

Block 3 - Extract Text with Typhoon OCR

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

Block 4 - Structure Text to JSON with LLM

Type / Role
@n8n/n8n-nodes-langchain.chainLlm - chainLlm
Config choices
Version 1.6

Block 5 - Parse JSON to Sheet Format

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

Block 6 - Save to Google Sheet

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

Block 7 - Load PDFs from doc Folder

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

Block 8 - Sticky Note

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

3. Summary Table

Workflow Extract and structure Thai documents to Google Sheets using Typhoon OCR and Llama 3.1
Complexity intermediate
Nodes 8
Categories Document Extraction, AI Summarization
Author Jaruphat J.
Published 22 May 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/4300/4300.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 and structure Thai documents to Google Sheets using Typhoon OCR and Llama 3.1 do?

️ Note: This template requires a community node and works only on self hosted n8n installations. It uses the Typhoon OCR Python package and custom command execut...

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.