Extract data from Thai Government letters with Mistral OCR and store in Google Sheets
$20/month : Unlimited workflows
2500 executions/month
THE #1 IN WEB SCRAPING
Scrape any website without limits
HOSTINGER 🎉 Early Black Friday Deal
DISCOUNT 20% Try free
DISCOUNT 20%
Self-hosted n8n
Unlimited workflows - from $4.99/mo
#1 hub for scraping, AI & automation
6000+ actors - $5 credits/mo
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:
- Receives documents from two sources:
- LINE webhook (via Messaging API)
- Google Drive (new file trigger)
- Checks file type (PDF or image)
- Runs OCR with Mistral AI (Document or Image model)
- Uses OpenAI to extract key metadata such as:
- book_id
- subject
- recipient (to)
- signatory
- date, contact info, etc.
- Stores structured data in Google Sheets
- Replies to LINE user with extracted info or moves files into archive folders (Drive)
How to Set It Up
- Create a Google Sheet with a tab named
dataand the following columns Example Google Sheet:book_id,date,subject,to,attach,detail,signed_by,signed_by_position,contact_phone,contact_email,download_url
- Set up required credentials:
googleDriveOAuth2ApigoogleSheetsOAuth2ApihttpHeaderAuthfor LINE Messaging APIopenAiApimistralCloudApi
- Define environment variables:
LINE_CHANNEL_ACCESS_TOKENGDRIVE_INVOICE_FOLDER_IDGSHEET_IDMISTRAL_API_KEY
- Deploy webhook to receive files from LINE Messaging API (Path:
/line-invoice) - Monitor Drive uploads using
Google Drive Trigger
How to Customize the Workflow
- Adjust the information extraction schema in the OpenAI
Information Extractornode to match your document layout - Add logic for different document types if you have more than one format
- Modify the
LINE Replymessage format or use Flex Message - Update the
Move Filenode 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