Extract & process invoices with Gemini AI, Google Sheets & Gmail notifications
AI-Powered Invoice Extraction & Automation System Workflow
Aim
The aim of the Invoice Data Automation workflow is to streamline invoice processing by extracting, validating, and storing invoice details automatically. It uses AI to read invoices (from images/PDFs), structures the data in JSON, checks for missing or duplicate entries, and records the information in a Google Sheet while also uploading the original invoice to Google Drive. Additionally, it sends email notifications for successful entries, duplicates, or missing fields.
Goal
The goal is to:
- Allow users to upload invoice images/files via chat.
- Extract invoice data using AI and format it into a structured JSON.
- Validate mandatory fields like
invoice_id,shop_name,date,Total, anditems. - Check if the invoice already exists in the Google Sheet.
- Append new invoices to Google Sheets and upload the original file to Google Drive.
- Notify the user via email about success, duplicates, or errors.
This ensures that invoices are processed accurately, efficiently, and securely with minimal manual effort.
Requirements
The workflow relies on specific components and configurations:
n8n Platform
The automation is built and hosted on n8n, which orchestrates the entire workflow.
Node Requirements
- When chat message received – Triggers the workflow when a user submits an invoice.
- Analyze image1 – Uses Google Gemini Vision AI to extract invoice data from the uploaded file.
- AI Agent1 + Google Gemini Chat Model1 – Restructures the extracted data into strict JSON format.
- Make data in JSON structure format – Prepares and organizes the structured output.
- Get data – Looks up the Google Sheet to check if the invoice already exists.
- check if Data exist or not in table – Decides whether to process as new data or duplicate.
- New data add using payload / Check Mandatory fields – Ensures invoice JSON is valid and complete.
- If – check missing field – Branches based on whether mandatory fields are present.
- no missing field – new data add using payload 2 – Passes only verified invoices forward.
- Append data to sheet – Saves invoice data in Google Sheets.
- Upload invoice to drive – Uploads the original invoice file to Google Drive.
- Send successful email – Notifies the user of successful entry.
- Duplicate entry send mail – Alerts the user if the invoice already exists.
- Send missing field error on mail – Sends an error email if mandatory fields are missing.
Credentials
- Google Gemini (PaLM) API – For AI-based invoice data extraction and formatting.
- Google Sheets API – For storing structured invoice records.
- Google Drive API – For uploading original invoices.
- Gmail API – For sending success, duplicate, and error notifications.
Input Requirements
- Invoice file (Image or PDF).
Output
- Structured invoice data in Google Sheets.
- Original invoice stored in Google Drive.
- Notifications sent via Gmail (success, duplicate, or error).
API Usage
-
Google Gemini (PaLM API): Used in Analyze image1 and AI Agent1 to extract and structure invoice data. It ensures fields like
invoice_id,shop_name,date, anditemsare clearly formatted. -
Google Sheets API: Used in Get data and Append data to sheet nodes to validate duplicates and store new invoices.
-
Google Drive API: Used in Upload invoice to drive to securely store the original uploaded invoice file.
-
Gmail API: Used in Send successful email, Duplicate entry send mail, Send missing field error on mail to notify users about the status of invoice processing.
Workflow Summary
The Invoice Data Automation workflow automates the entire process of invoice handling by:
- Receiving invoice uploads via chat.
- Extracting invoice details with AI (Google Gemini).
- Structuring and validating the data in JSON format.
- Checking Google Sheets for duplicates.
- Appending new invoices to the sheet and uploading originals to Google Drive.
- Sending email notifications to keep the user updated on the process outcome.
This end-to-end automation ensures invoices are handled with speed, accuracy, and transparency, reducing manual work and eliminating common errors in invoice management.
n8n Invoice Processing with Gemini AI, Google Sheets, and Gmail Notifications
This n8n workflow automates the extraction and processing of invoice data using Google Gemini AI, stores the extracted information in Google Sheets, and sends email notifications via Gmail. It's designed to streamline accounts payable or expense management by intelligently handling incoming invoices.
What it does
This workflow performs the following key steps:
- Triggers on Chat Message: The workflow is initiated when a chat message is received, likely containing a prompt or command to process invoices.
- AI Agent for Invoice Processing: An AI Agent (powered by Google Gemini Chat Model) is used to process the incoming request, likely to identify and extract relevant information from an invoice.
- Google Gemini for Document Analysis: The Google Gemini node is employed, suggesting it interacts with the Gemini API to analyze document content (e.g., PDF invoices) to extract structured data.
- Google Drive Interaction: The workflow interacts with Google Drive, likely to retrieve invoice files or store processed documents.
- Data Transformation (Edit Fields): A "Set" node (named "Edit Fields") is used to transform or structure the data extracted by the AI, preparing it for storage.
- Conditional Logic (If): An "If" node introduces conditional branching, allowing the workflow to take different paths based on certain criteria, perhaps validating extracted data or checking for specific invoice types.
- Google Sheets Integration: Extracted invoice data is written to or updated in a Google Sheet.
- Gmail Notifications: The workflow sends email notifications via Gmail, potentially to confirm successful processing, alert about errors, or notify relevant stakeholders.
- Code Execution: A "Code" node is present, indicating custom JavaScript logic is executed at some point in the workflow, likely for advanced data manipulation or integration.
- Sticky Note: A "Sticky Note" is included, which typically serves as documentation or a reminder within the workflow itself.
Prerequisites/Requirements
To use this workflow, you will need:
- n8n Instance: A running n8n instance.
- Google Account: A Google account with access to:
- Google Sheets: For storing invoice data.
- Google Drive: For accessing or storing invoice files.
- Gmail: For sending notifications.
- Google Gemini API Key: Access to the Google Gemini API for the AI Agent and Google Gemini nodes.
- n8n Credentials: Configured n8n credentials for Google (OAuth 2.0 or Service Account) and Google Gemini.
Setup/Usage
- Import the Workflow: Import the provided JSON into your n8n instance.
- Configure Credentials:
- Set up your Google OAuth 2.0 or Service Account credentials for the Google Sheets, Google Drive, and Gmail nodes.
- Configure your Google Gemini API Key credentials for the AI Agent and Google Gemini nodes.
- Customize Nodes:
- Chat Trigger: Configure the "When chat message received" node according to your desired chat platform and trigger conditions.
- AI Agent / Google Gemini: Review and adjust the prompts and configurations for the AI Agent and Google Gemini nodes to accurately extract the desired invoice information.
- Google Drive: Specify the folder or file IDs for your invoice documents.
- Edit Fields (Set): Adjust the data mapping to ensure extracted fields are correctly formatted for your Google Sheet.
- If: Define the conditions for your conditional logic based on your business rules (e.g., invoice amount, vendor, status).
- Google Sheets: Specify the spreadsheet ID, sheet name, and column mappings for where the invoice data should be stored.
- Gmail: Customize the recipient, subject, and body of the email notifications.
- Code: If custom logic is required, modify the "Code" node accordingly.
- Activate the Workflow: Once configured, activate the workflow to start processing invoices automatically.
Related Templates
Generate song lyrics and music from text prompts using OpenAI and Fal.ai Minimax
Spark your creativity instantly in any chat—turn a simple prompt like "heartbreak ballad" into original, full-length lyrics and a professional AI-generated music track, all without leaving your conversation. 📋 What This Template Does This chat-triggered workflow harnesses AI to generate detailed, genre-matched song lyrics (at least 600 characters) from user messages, then queues them for music synthesis via Fal.ai's minimax-music model. It polls asynchronously until the track is ready, delivering lyrics and audio URL back in chat. Crafts original, structured lyrics with verses, choruses, and bridges using OpenAI Submits to Fal.ai for melody, instrumentation, and vocals aligned to the style Handles long-running generations with smart looping and status checks Returns complete song package (lyrics + audio link) for seamless sharing 🔧 Prerequisites n8n account (self-hosted or cloud with chat integration enabled) OpenAI account with API access for GPT models Fal.ai account for AI music generation 🔑 Required Credentials OpenAI API Setup Go to platform.openai.com → API keys (sidebar) Click "Create new secret key" → Name it (e.g., "n8n Songwriter") Copy the key and add to n8n as "OpenAI API" credential type Test by sending a simple chat completion request Fal.ai HTTP Header Auth Setup Sign up at fal.ai → Dashboard → API Keys Generate a new API key → Copy it In n8n, create "HTTP Header Auth" credential: Name="Fal.ai", Header Name="Authorization", Header Value="Key [Your API Key]" Test with a simple GET to their queue endpoint (e.g., /status) ⚙️ Configuration Steps Import the workflow JSON into your n8n instance Assign OpenAI API credentials to the "OpenAI Chat Model" node Assign Fal.ai HTTP Header Auth to the "Generate Music Track", "Check Generation Status", and "Fetch Final Result" nodes Activate the workflow—chat trigger will appear in your n8n chat interface Test by messaging: "Create an upbeat pop song about road trips" 🎯 Use Cases Content Creators: YouTubers generating custom jingles for videos on the fly, streamlining production from idea to audio export Educators: Music teachers using chat prompts to create era-specific folk tunes for classroom discussions, fostering interactive learning Gift Personalization: Friends crafting anniversary R&B tracks from shared memories via quick chats, delivering emotional audio surprises Artist Brainstorming: Songwriters prototyping hip-hop beats in real-time during sessions, accelerating collaboration and iteration ⚠️ Troubleshooting Invalid JSON from AI Agent: Ensure the system prompt stresses valid JSON; test the agent standalone with a sample query Music Generation Fails (401/403): Verify Fal.ai API key has minimax-music access; check usage quotas in dashboard Status Polling Loops Indefinitely: Bump wait time to 45-60s for complex tracks; inspect fal.ai queue logs for bottlenecks Lyrics Under 600 Characters: Tweak agent prompt to enforce fuller structures like [V1][C][V2][B][C]; verify output length in executions
Automate Dutch Public Procurement Data Collection with TenderNed
TenderNed Public Procurement What This Workflow Does This workflow automates the collection of public procurement data from TenderNed (the official Dutch tender platform). It: Fetches the latest tender publications from the TenderNed API Retrieves detailed information in both XML and JSON formats for each tender Parses and extracts key information like organization names, titles, descriptions, and reference numbers Filters results based on your custom criteria Stores the data in a database for easy querying and analysis Setup Instructions This template comes with sticky notes providing step-by-step instructions in Dutch and various query options you can customize. Prerequisites TenderNed API Access - Register at TenderNed for API credentials Configuration Steps Set up TenderNed credentials: Add HTTP Basic Auth credentials with your TenderNed API username and password Apply these credentials to the three HTTP Request nodes: "Tenderned Publicaties" "Haal XML Details" "Haal JSON Details" Customize filters: Modify the "Filter op ..." node to match your specific requirements Examples: specific organizations, contract values, regions, etc. How It Works Step 1: Trigger The workflow can be triggered either manually for testing or automatically on a daily schedule. Step 2: Fetch Publications Makes an API call to TenderNed to retrieve a list of recent publications (up to 100 per request). Step 3: Process & Split Extracts the tender array from the response and splits it into individual items for processing. Step 4: Fetch Details For each tender, the workflow makes two parallel API calls: XML endpoint - Retrieves the complete tender documentation in XML format JSON endpoint - Fetches metadata including reference numbers and keywords Step 5: Parse & Merge Parses the XML data and merges it with the JSON metadata and batch information into a single data structure. Step 6: Extract Fields Maps the raw API data to clean, structured fields including: Publication ID and date Organization name Tender title and description Reference numbers (kenmerk, TED number) Step 7: Filter Applies your custom filter criteria to focus on relevant tenders only. Step 8: Store Inserts the processed data into your database for storage and future analysis. Customization Tips Modify API Parameters In the "Tenderned Publicaties" node, you can adjust: offset: Starting position for pagination size: Number of results per request (max 100) Add query parameters for date ranges, status filters, etc. Add More Fields Extend the "Splits Alle Velden" node to extract additional fields from the XML/JSON data, such as: Contract value estimates Deadline dates CPV codes (procurement classification) Contact information Integrate Notifications Add a Slack, Email, or Discord node after the filter to get notified about new matching tenders. Incremental Updates Modify the workflow to only fetch new tenders by: Storing the last execution timestamp Adding date filters to the API query Only processing publications newer than the last run Troubleshooting No data returned? Verify your TenderNed API credentials are correct Check that you have setup youre filter proper Need help setting this up or interested in a complete tender analysis solution? Get in touch 🔗 LinkedIn – Wessel Bulte
AI-powered code review with linting, red-marked corrections in Google Sheets & Slack
Advanced Code Review Automation (AI + Lint + Slack) Who’s it for For software engineers, QA teams, and tech leads who want to automate intelligent code reviews with both AI-driven suggestions and rule-based linting — all managed in Google Sheets with instant Slack summaries. How it works This workflow performs a two-layer review system: Lint Check: Runs a lightweight static analysis to find common issues (e.g., use of var, console.log, unbalanced braces). AI Review: Sends valid code to Gemini AI, which provides human-like review feedback with severity classification (Critical, Major, Minor) and visual highlights (red/orange tags). Formatter: Combines lint and AI results, calculating an overall score (0–10). Aggregator: Summarizes results for quick comparison. Google Sheets Writer: Appends results to your review log. Slack Notification: Posts a concise summary (e.g., number of issues and average score) to your team’s channel. How to set up Connect Google Sheets and Slack credentials in n8n. Replace placeholders (<YOURSPREADSHEETID>, <YOURSHEETGIDORNAME>, <YOURSLACKCHANNEL_ID>). Adjust the AI review prompt or lint rules as needed. Activate the workflow — reviews will start automatically whenever new code is added to the sheet. Requirements Google Sheets and Slack integrations enabled A configured AI node (Gemini, OpenAI, or compatible) Proper permissions to write to your target Google Sheet How to customize Add more linting rules (naming conventions, spacing, forbidden APIs) Extend the AI prompt for project-specific guidelines Customize the Slack message formatting Export analytics to a dashboard (e.g., Notion or Data Studio) Why it’s valuable This workflow brings realistic, team-oriented AI-assisted code review to n8n — combining the speed of automated linting with the nuance of human-style feedback. It saves time, improves code quality, and keeps your team’s review history transparent and centralized.