Use this comprehensive n8n workflow to automatically monitor Gmail attachments, parse documents using LlamaParse, classify content via AI, extract structured JSON invoice data, and save everything to Google Sheets and Drive.
Download this n8n workflow template and start using it instantly.
Accounting & Finance Teams: Automating the capture of structured data from complex invoices, statements, and receipts.
Operations Specialists: Seeking highly efficient, AI-powered solutions to manage high volumes of incoming documents.
n8n Developers: Looking for advanced examples of integrating external asynchronous AI services (like LlamaParse) using webhooks and managing conditional logic.
Business Analysts: Needing reliable and structured data for reporting and integration into BI tools via Google Sheets.
This powerful n8n workflow provides a comprehensive, two-stage system for document intelligence, starting with the Gmail Trigger n8n node and ending with structured data storage. It solves the critical challenge of converting complex file formats (PDFs, images) into usable, structured JSON data. By leveraging the deep parsing abilities of LlamaParse, the workflow achieves superior text extraction fidelity. The subsequent AI processing, using a LangChain LLM n8n node, automatically classifies the document and extracts precise financial details according to a strict JSON schema. This allows users to deploy robust n8n templates that streamline financial processing, ensuring accurate, automated record-keeping in Google Sheets and secure archiving in Google Drive. This entire n8n workflow demonstrates how to build resilient, enterprise-grade automations using core n8n features combined with specialized AI services.
This n8n workflow operates in two main phases: Ingestion/Submission and Webhook Callback Processing.
Gmail Trigger n8n node continuously monitors the inbox for new emails, specifically looking for messages containing attachments, which acts as the starting n8n trigger.HTTP Request and an If Supported File Extensions n8n node.Save Document to Google Drive), and the job is submitted to LlamaParse via an HTTP Request n8n node. A temporary record containing the LlamaParse jobId and the Google Drive URL is logged in Google Sheets (Save LlamaParse ID and Summary to Google Sheets).Summarize Email n8n node and an OpenAI model.Webhook n8n trigger listens for LlamaParse to complete the document parsing. The response contains the high-quality parsed document content in Markdown format.Classify Parsed Document LangChain n8n node, which classifies it as either an 'invoice' or 'not invoice'.Summarize Document n8n node for executive summary creation, which is then sent via Telegram.Extract Invoice Details as JSON LangChain n8n node. This highly specific n8n node uses a robust prompt instructing the LLM to output precise financial data (including taxes, fees, and subtotals) strictly conforming to a predefined JSON schema.jobId and updates it with all the final financial and summary information (Update Google Sheet by LlamaParse ID). A final notification is sent via a Telegram n8n node.This robust architecture ensures efficient, reliable AI processing within your n8n workflow.
To deploy this advanced n8n workflow, follow these steps:
Gmail Trigger and Get Message n8n node.TELEGRAMCHATID environment variable set).HTTP Request n8n node uses a dynamic webhook URL (=https://[YOUR-N8N-URL]/webhook/parse). Ensure you replace [YOUR-N8N-URL] with the base URL of your live n8n instance.Google Sheets n8n nodes to point to your specific spreadsheet (Document ID and Sheet Name). Review the prompt in the Extract Invoice Details as JSON LangChain n8n node and update the schema to perfectly match your target data requirements.Gmail Trigger n8n node to active.This n8n workflow utilizes several key nodes for its complex operations:
Gmail Trigger: The primary starting n8n trigger. Key Configuration: Filters are set for messages containing attachments (has:attachment).
Webhook (n8n node): Acts as the listener for the LlamaParse callback when the document parsing is complete.
HTTP Request (LlamaParse Submission): Used to send the attached binary file to the LlamaParse API. Key Configuration: Method is POST, Content Type is multipart-form-data, and includes webhook_url parameter for the callback.
Google Sheets (Append/Update): Used both early on to log the job ID, and later to update the row with extracted data. Key Configuration: Operation: updateOrAppend, matching column is jobid.
LangChain Text Classifier (Classify Parsed Document): An essential AI n8n node that routes the n8n workflow. Key Configuration: Defines categories like invoice and not invoice to determine subsequent processing.
LangChain LLM Chain (Extract Invoice Details as JSON): The core AI extraction n8n node. Key Configuration: Uses a highly prescriptive system prompt to ensure the output is a valid JSON object conforming to a detailed financial schema (including tracking container deposits, multiple tax types, and transaction details).
Set (Invoice Details & Prepare Data): Standard n8n node used for reorganizing and mapping data fields between steps before final saving or notification.
Telegram (n8n node): Sends status updates and the final summary/extracted financial data to the configured chat ID for real-time monitoring.
Use this comprehensive n8n workflow to build a sophisticated AI chatbot. It connects GPT-4o-mini agents to query Postgres/Supabase databases and generate dynamic data charts via QuickChart.io using advanced n8n node logic.

Create a robust, custom Ideogram AI interface using this advanced n8n workflow. Automate image generation, upscaling, remixing, and save results to Google Drive and Sheets.

Automate structured data extraction from webpages using a smart n8n workflow. This n8n workflow uses Gemini's vision capabilities, ScrapingBee, and Google Sheets for high-accuracy web scraping.

Securely automate your daily n8n workflow backups to Google Drive. This n8n workflow template includes a 7-day retention policy, using the n8n API and Google Drive nodes for administrative automation.

Automate your social media strategy using this powerful n8n workflow. Generate tailored content for X, LinkedIn, Instagram, and Facebook using an AI Agent, enforce human approval via Gmail, and auto-publish the approved content. This advanced n8n template streamlines marketing efforts.

A powerful n8n workflow template utilizing AI Agents (GPT-4o) and dynamic configuration via Google Docs to generate, review, and publish platform-optimized content across X, Instagram, Facebook, and LinkedIn. Automate your social media strategy with this flexible n8n solution.


As an AI Automation consultant based in Canada, I partner with forward-thinking organizations to implement AI solutions that streamline operations and drive growth.







































