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
Automate invoice processing with n8n and Outlook

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

Learn how to Build this Workflow with AI:

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


Automate invoice processing with n8n and Outlook

Visit through Desktop to Interact with the Workflow.

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 Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.