Automate Invoice Processing with n8n & Microsoft Outlook

This n8n workflow automates invoice extraction from Microsoft Outlook emails using AI-powered classification and OCR, saving hours on manual invoice handling. It downloads attachments, identifies invoices, extracts detailed invoice data, and logs it in Excel automatically.
microsoftOutlook
textClassifier
httpRequest
+9
Workflow Identifier: 1217
NODES in Use: scheduleTrigger, microsoftOutlook, markdown, textClassifier, splitInBatches, code, httpRequest, filter, if, set, wait, microsoftExcel

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

What This Automation Does

This workflow scans an Outlook inbox folder every hour and finds emails with attachments.

It uses AI to check if the email is actually an invoice or not.

Then, it downloads and splits the attachments, checks each file if it really is an invoice using Google Gemini AI vision.

After confirming invoices, it extracts detailed data from PDF invoices with Google Gemini OCR.

Finally, it saves the extracted information into an Excel file for easy tracking.


Tools and Services Used

  • Microsoft Outlook: Email inbox where invoice messages arrive.
  • n8n Automation Platform: Builds and runs the workflow.
  • Google Gemini (PaLM) API: AI text classification, vision, and OCR.
  • Microsoft Excel 365: Target store for invoice data.

Inputs → Processing Steps → Output

Inputs

  • Emails with attachments arriving in a specific Outlook folder within the last hour.

Processing Steps

  • Get emails with attachments from Outlook.
  • Convert email body HTML to markdown for better AI understanding.
  • Use AI text classifier to pick invoice emails.
  • Split email items to process one at a time.
  • Download attachments from selected invoices.
  • Split multi-attachment messages into single file items.
  • Call Google Gemini AI to confirm each attachment is an invoice addressed to the company.
  • Filter out non-invoice files.
  • Extract detailed invoice data by sending PDF files to Google Gemini OCR.
  • Format the extracted data and relate it to the original email metadata.
  • Append structured invoice data as rows in an Excel spreadsheet.
  • Wait 1 second between batches to avoid hitting API limits.

Output

  • Rows of extracted invoice information saved automatically in an Excel workbook.

Who Should Use This Workflow

Anyone handling many vendor emails and manually entering invoice data will find this helpful.

This reduces spending many hours downloading, checking, and typing details manually.

It is designed for people with Outlook and Excel 365, wanting healthier email workflow and fewer errors.


Beginner Step-by-Step: How to Use This Workflow in n8n

Step 1: Import the Workflow

  1. Download the workflow from this page using the Download button.
  2. Inside the n8n editor, click “Import from File” and select the downloaded workflow file.

Step 2: Add Needed Credentials and Update Settings

  1. Add Microsoft Outlook OAuth2 credentials in Microsoft Outlook nodes.
  2. Add Google Gemini API credentials for all HTTP Request nodes that call Google API.
  3. Add Microsoft Excel 365 credentials and check worksheet and workbook IDs in the Microsoft Excel 365 node.
  4. Check folder IDs or email addresses used in the Outlook nodes and update if your mailbox uses different folders.
  5. If the Code or Prompt blocks are present, copy and paste them exactly where needed.

Step 3: Test the Workflow

  1. Run the workflow manually once to check connections and see if emails and invoices are processed properly.
  2. Review console logs and check the output data in Excel sheet.

Step 4: Activate for Production

  1. Turn on the workflow so the Schedule Trigger runs every hour automatically.
  2. Monitor executions regularly to confirm error free operation.
  3. Adjust schedule frequency or API limits as needed.

Note: For self-host n8n, import this workflow similarly to run on your server.


Customizations You Can Try

  • Add more email categories in the AI classifier, like purchase orders or credit notes.
  • Send results to a database instead of Excel if preferred.
  • Use a Remove Duplicates node to avoid saving the same invoice twice.
  • Switch from Schedule Trigger to an Outlook Trigger node for near real-time processing.
  • Change prompts to extract more data fields like tax numbers or payment terms.

Troubleshooting

No emails fetched? Check folder IDs and make sure Outlook credentials have access.

Attachments not downloading? Turn on the “Download Attachments” option and verify message IDs are correctly referenced.

AI classification returns wrong results? Confirm input text is correct and API key is valid with quota remaining.


Pre-Production Checklist

  • Test Microsoft Outlook credentials and mailbox access.
  • Test Google Gemini API keys with a sample request.
  • Verify Microsoft Excel workbook and worksheet IDs.
  • Run the workflow manually on test emails.
  • Backup Excel files before live use.

Deployment Guide

Activate the workflow to start hourly email checks.

Watch execution logs in n8n UI for errors.

If there is high volume, add throttling or smaller batch sizes to stay under API limits.

Use n8n logging and alert features to monitor workflow health.


Summary

✓ Saves many hours of manual invoice handling

✓ Cuts down errors by automating invoice data extraction

✓ Gives clear, updated invoice records in Excel

→ Checks Outlook inbox on schedule and finds real invoice emails

→ Uses AI to separate invoices from other emails and attachments

→ Extracts detailed invoice data with Google Gemini OCR API

→ Automatically saves invoice details in Excel for easy tracking


Frequently Asked Questions

Yes, other AI services can replace Google Gemini if they support text classification and OCR. The user must adjust node configurations accordingly.
The workflow is set by default to check every hour via the Schedule Trigger node but this can be adjusted.
Such attachments are filtered out and not processed further or saved to Excel.
Data is handled securely using API authentication. Sensitive files are processed during workflow runtime and not stored permanently unless configured.

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free