πŸ”¬ Extract data from Thai Government letters with Mistral OCR and store in Google Sheets

⚑ 1,697 views Β· πŸ”¬ Document Extraction & Analysis

πŸ’‘ Pro Tip β€” HTTP Request scraping tends to break when sites update their markup. If you’re scraping a major platform, check if ScraperNode covers it β€” it has maintained scrapers for LinkedIn, Instagram, TikTok, YouTube, and 20+ other platforms that return structured data.

View All Scrapers

Description

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?


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


Requirements


Notes

πŸ”— Nodes Used

Google Sheets, HTTP Request, Webhook, Google Drive, Google Drive Trigger, OpenAI Chat Model

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup