Extract and log Outlook invoices to OneDrive Excel with GPT-4.1-mini

Go to Workflow
47 views
Built by AI Solutions AI Solutions
Created on May 14, 2026

Description

Quick overview
Automatically extract, log, and archive emailed invoices using GPT-4.1-mini, OneDrive, and Excel. Designed for small business owners, finance teams, and operations managers, this Microsoft 365 workflow eliminates manual data entry while keeping invoices organized and easy to track.

How it works
Runs daily at 7:00 AM and retrieves unread emails from a selected Outlook folder.
Converts each email to plain text and uses GPT-4.1-mini to extract invoice details.
Downloads PDF attachments and saves them in dated OneDrive folders.
Renames each invoice using the vendor and invoice month.
Adds the extracted data and file link to an Excel table.

Setup
Add your Microsoft Outlook OAuth2 credential — used to fetch emails and send the digest.
Add your Microsoft Graph OAuth2 credential — used for OneDrive folder creation, PDF upload, and Excel append.
In Outlook — Get Unread Emails, update foldersToInclude to your target Outlook folder ID (find it via Graph Explorer).
In Excel — Append Invoice Row, update the workbook, worksheet, and table IDs to match your tblInvoices tracker file in OneDrive.
In Code — Build Digest Email, replace YOUR_ONEDRIVE_FOLDER_URL with a direct link to your Invoices folder.
In Outlook — Send Daily Digest, replace [email protected] with your recipient address.

Requirements
Microsoft Outlook OAuth2 credential
Microsoft Graph OAuth2 credential (Generic OAuth2 with https://graph.microsoft.com/.default scope)
OpenAI API credential (GPT-4.1-mini)
An Excel workbook in OneDrive with a table named tblInvoices containing columns matching the field list
A PDF Link column added to your tblInvoices table

Customization
Change the schedule: Adjust the cron expression in Schedule — Daily Trigger to run more or less frequently.
Add more fields: Extend the extraction prompt in AI — Extract Invoice Fields with additional fields and add matching columns to your Excel table.
Modify the folder structure: Edit Code — Build Upload Path to change how PDF subfolders are named or organized in OneDrive.
Filter by sender or subject: Add a Filter node after Outlook — Get Unread Emails to process only emails matching specific criteria.

Additional info
Support: [email protected] | Automated Intelligent Solutions

Nodes Used (6)

Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm
Code
n8n-nodes-base.code
HTTP Request
n8n-nodes-base.httpRequest
Microsoft Excel 365
n8n-nodes-base.microsoftExcel
Microsoft Outlook
n8n-nodes-base.microsoftOutlook
OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi