Category: Automations › Invoicing & Accounting · Best for: Invoice-heavy businesses · Platform: n8n · Steps: 36
What it does
The AI reads invoices and documents and pulls out the important details.
https://docs.cloud.llamaindex.ai/API/upload-file-api-v-1-parsing-upload-post
Works with: Gmail, OpenAI, Text Classifier, Chain Llm, Google Drive, Telegram, Google Sheets
What you get
- The n8n workflow file (
workflow.json), ready to import - This setup guide
- The list of fields to change for your own accounts (see Install below)
- Email support if you get stuck
Before you start
-
An n8n account. Easiest: n8n Cloud (free trial). Self-host for free with Docker:
docker run -it --rm -p 5678:5678 -v n8n_data:/home/node/.n8n docker.n8n.io/n8nio/n8n, then open http://localhost:5678. -
Accounts and API keys for these services:
- Google (Sheets, Gmail, Drive, Calendar, Docs): how to connect (used by Gmail, Gmail Trigger, Get Message, Save LlamaParse ID and Summary to Google Sheets, Save Document to Google Drive, Update Google Sheet by LlamaParse ID, Save Summarized Document to Google Drive, Save Parsed Document to Google Drive)
- API key sent as an HTTP header (see the node for which service): how to connect (used by Parse Document with LlamaParse)
- OpenAI API key: how to connect (used by gpt-4o-mini, gpt-4o-mini1, gpt-4o-mini2, gpt-4o-mini3)
- Telegram bot token from @BotFather: how to connect (used by Send Invoice Details as Telegram Message, Send Error Message 2, Send Error Message 1, Send Document Summary as Telegram Message)
Install
- In n8n, click Create workflow (top right).
- Click the ⋯ menu → Import from file and choose
workflow.json. Or open the file, copy everything and paste it onto the empty canvas with Ctrl/Cmd + V. - Open each node with a red warning triangle and pick or create the matching credential from the list above.
- Point these fields at your own sheets, chats and accounts:
- Gmail →
sender: replace the placeholder with your own - Save LlamaParse ID and Summary to Google Sheets →
sheetName: choose your own - Save LlamaParse ID and Summary to Google Sheets →
documentId: choose your own - Save Document to Google Drive →
driveId: choose your own - Save Document to Google Drive →
folderId: choose your own - Update Google Sheet by LlamaParse ID →
sheetName: choose your own - Update Google Sheet by LlamaParse ID →
documentId: choose your own - Send Invoice Details as Telegram Message →
chatId: choose your own - Send Error Message 2 →
chatId: choose your own - Send Error Message 1 →
chatId: choose your own - Send Document Summary as Telegram Message →
chatId: choose your own - Save Summarized Document to Google Drive →
driveId: choose your own - Save Summarized Document to Google Drive →
folderId: choose your own - Save Parsed Document to Google Drive →
driveId: choose your own - Save Parsed Document to Google Drive →
folderId: choose your own
- Gmail →
- Click Save.
Test it
- Click Test workflow (or Execute workflow). Gmail Trigger starts it. Trigger it once with real sample data.
- Click each node to check its output. A green tick means the step worked.
- Fix any red node: it's almost always a credential or a field that still points at a sheet or chat that isn't yours.
Go live
Toggle Active (top right). From now on it runs on its own. Check Executions in the left sidebar to see every run.
How it works, step by step
- Gmail Trigger starts the workflow (Gmail).
- Webhook starts the workflow (Webhook).
- gpt-4o-mini1 uses AI (OpenAI).
- gpt-4o-mini2 uses AI (OpenAI).
- gpt-4o-mini3 uses AI (OpenAI).
- gpt-4o-mini uses AI (OpenAI).
- Gmail uses Gmail to getAll.
- Get Parsed Markdown reshapes the data for the next step.
- Classify Parsed Document uses AI (Text Classifier).
- Extract Invoice Details as JSON uses AI (Chain Llm).
- Summarize Document uses AI (Chain Llm).
- Summarize Email uses AI (Chain Llm).
- Limit uses Limit.
- Save Parsed Document to Google Drive uses Google Drive to createFromText.
- Invoice Details reshapes the data for the next step.
- Send Error Message 2 uses Telegram.
- Send Document Summary as Telegram Message uses Telegram.
- Save Summarized Document to Google Drive uses Google Drive to createFromText.
- Send Error Message 1 uses Telegram.
- Merge Email Processing uses Merge.
- Get Message uses Gmail to get.
- Prepare Message reshapes the data for the next step.
- Update Google Sheet by LlamaParse ID uses Google Sheets to update.
- Save LlamaParse ID and Summary to Google Sheets uses Google Sheets to appendOrUpdate.
- Is there an Email Attachement checks a condition and routes items accordingly.
- Send Invoice Details as Telegram Message uses Telegram.
- HTTP Request calls an external API (https://api.cloud.llamaindex.ai/api/parsing/supported_file_e).
- Merge uses Merge.
- No Operation, do nothing uses No Op.
- Aggregate uses Aggregate.
- Parse Document with LlamaParse calls an external API (https://api.cloud.llamaindex.ai/api/parsing/upload).
- Save Document to Google Drive uses Google Drive.
- Edit Fields reshapes the data for the next step.
- Prepare Data reshapes the data for the next step.
- If Supported File Extensions checks a condition and routes items accordingly.
- No Operation, do nothing1 uses No Op.
India & US notes
India: add GSTIN, HSN/SAC and GST amount columns to your sheet so the AI extracts them too. US: add sales-tax and EIN columns as needed.
Extra setup notes
These notes are also on the canvas as yellow sticky notes:
Send to LlamaParse
https://docs.cloud.llamaindex.ai/API/upload-file-api-v-1-parsing-upload-post
Check for Supported File Extension
Get Emails with Attachments
Disclaimer
This workflow only processes the the first attachment of the email. Adjust search and limit settings to suit your use case.
Save Document to Google Drive
Summarize the Email Message
Save To Google Sheets
Description
This workflow automates document processing using LlamaParse to extract and analyze text from various file formats. It intelligently processes documents, extracts structured data, and delivers actionable insights through multiple channels.
How It Works
Document Ingestion & Processing
- Monitors Gmail for incoming attachments or accepts documents via webhook
- Validates file formats against supported LlamaParse extensions
- Uploads documents to LlamaParse for advanced text extraction
- Stores original documents in Google Drive for reference
Intelligent Document Analysis
- Automatically classifies document types (invoices, reports, etc.)
- Extracts structured data using customized AI prompts
- Generates comprehensive document summaries with key insights
- Converts unstructured text into organized JSON data
Invoice Processing Automation
- Extracts critical invoice details (dates, amounts, line items)
- Organizes financial data into structured formats
- Calculates tax breakdowns, subtotals, and payment information
- Maintains detailed records for accounting purposes
Multi-Channel Delivery
- Saves extracted data to Google Sheets for tracking and analysis
- Sends concise summaries via Telegram for immediate review
- Creates searchable document archives in Google Drive
- Updates spreadsheets with structured financial information
Setup Steps
Configure API Credentials
- Set up LlamaParse API connection
- Configure Gmail OAuth for email monitoring
- Set up Google Drive and Sheets integrations
- Add Telegram bot credentials for notifications
Customize AI Processing
- Adjust document classification parameters
- Modify extraction templates for specific document types
- Fine-tune summary generation prompts
- Customize invoice data extraction schema
Test and Deploy
- Test with sample documents of various formats
- Verify data extraction accuracy
- Confirm notification delivery
- Monitor processing pipeline performance
Try Me!
Advanced AI Powered Document Parsing & Text Extraction with Llama Parse
Example Invoice Processing
Extract Invoice as JSON
Update User & System Prompt for Your Specific Use Case
Example Document Summarizing
Summarize Document
Update User & System Prompt for Your Specific Use Case
Classify Parsed Document
Add More Classifications as Required
Parsed Markdown from LlamaParse
Receive Parsed Document from LlamaParse
Webhook to Receive LlamaParse Response
Save Parsed Document to Google Drive
Troubleshooting
- "Credentials not found": open the node and select your credential again.
- Google "access blocked": in Google Cloud, add your email as a test user on the OAuth consent screen.
- Webhook not firing: copy the node's Production URL (not Test URL) into the other app, and make sure the workflow is Active.
- AI node errors: check your API key has billing enabled and the model name exists on your plan.
- Nothing happens on schedule: the workflow must be Active, and self-hosted n8n must stay running.
Need help?
Reply to your Morning Method order email and we'll help you get it running.
© Morning Method