How to extract invoice data from PDFs with AI Builder into Excel
Updated 2 November 2026
What this flow does: Read PDF invoices from email with AI Builder and log the key fields in an Excel table. When it works: A new Excel row per PDF invoice with invoice number, supplier and total.
Before you start
- A Microsoft 365 account that can open make.powerautomate.com.
- Connections to: Office 365 Outlook, AI Builder, Excel Online (Business). Power Automate asks you to sign in to each the first time you add a step from it.
- A step here uses a premium connector, which needs a Power Automate Premium licence or AI Builder credits.
- An Excel table with InvoiceId, Vendor and Total columns.
The flow at a glance
- When a new email arrives · When a new email arrives (V3)
- For each attachment · Apply to each
- Inside the loop: Check if PDF · Condition
- If yes: Extract invoice data · Extract information from invoices
- Log invoice in Excel · Add a row into a table
Rename each step to the name shown. Expressions refer to steps by name, so a different name breaks them.
Build it step by step
1. When a new email arrives · Office 365 Outlook → When a new email arrives (V3)
Starts for emails with attachments.
In Power Automate, select Create, then the flow type (Automated cloud flow), name it, and choose this trigger.
| Box | Value | How it goes in |
|---|---|---|
| Folder Choose from the dropdown | Inbox | Open the dropdown and choose "Inbox". |
| Only with Attachments Choose from the dropdown | Yes | Open the dropdown and choose "Yes". |
| Include Attachments Choose from the dropdown | Yes | Open the dropdown and choose "Yes". |
2. For each attachment · Control → Apply to each
Repeats per attachment.
Select + below the previous step, then Add an action, search for Control and select Apply to each. Rename it to For each attachment.
| Box | Value | How it goes in |
|---|---|---|
| Select an output from previous steps Dynamic content | ⚡ Attachments | Click in the box, select the lightning-bolt (Dynamic content) button, then under the trigger pick "Attachments". |
3. Check if PDF · Control → Condition
Only PDFs.
Select + below the previous step (inside the loop), then Add an action, search for Control and select Condition. Rename it to Check if PDF.
| Box | Value | How it goes in |
|---|---|---|
| Left value Expression, in the fx box | toLower(items('For_each_attachment')?['name']) | Click in the box, select the fx (Expression) button, paste it into the expression box, then select Add. Don't type it as plain text. |
| Operator Choose from the dropdown | ends with | Open the dropdown and choose "ends with". |
| Right value Type or paste it | .pdf | Click in the box and paste it. |
4. Extract invoice data · AI Builder → Extract information from invoices
Reads fields from the PDF.
Select + below the previous step (if yes), then Add an action, search for AI Builder and select Extract information from invoices. Rename it to Extract invoice data.
| Box | Value | How it goes in |
|---|---|---|
| Invoice file Expression, in the fx box | base64ToBinary(items('For_each_attachment')?['contentBytes']) | Click in the box, select the fx (Expression) button, paste it into the expression box, then select Add. Don't type it as plain text. |
Double-check: Output token names can differ slightly between AI Builder versions. Look under Extract invoice data in the dynamic content list.
5. Log invoice in Excel · Excel Online (Business) → Add a row into a table
Adds a row.
Select + below the previous step, then Add an action, search for Excel Online (Business) and select Add a row into a table. Rename it to Log invoice in Excel.
| Box | Value | How it goes in |
|---|---|---|
| Location Your own site, list or folder | OneDrive for Business | Pick your own from the dropdown (for example: OneDrive for Business). |
| Document Library Your own site, list or folder | OneDrive | Pick your own from the dropdown (for example: OneDrive). |
| File Your own site, list or folder | Invoices.xlsx | Pick your own from the dropdown (for example: Invoices.xlsx). |
| Table Your own site, list or folder | InvoiceLog | Pick your own from the dropdown (for example: InvoiceLog). |
| InvoiceId Dynamic content | ⚡ Invoice ID value | Click in the box, select the lightning-bolt (Dynamic content) button, then under "Extract invoice data" pick "Invoice ID value". |
| Vendor Dynamic content | ⚡ Vendor name value | Click in the box, select the lightning-bolt (Dynamic content) button, then under "Extract invoice data" pick "Vendor name value". |
| Total Dynamic content | ⚡ Invoice total value | Click in the box, select the lightning-bolt (Dynamic content) button, then under "Extract invoice data" pick "Invoice total value". |
Test it
- Select Save, then Flow checker and fix anything it lists.
- Select Test → Manually → Test, then do the thing that starts the flow (send the email, submit the form, or run it).
- Open the run and check every step has a green tick. Then check the result: A new Excel row per PDF invoice with invoice number, supplier and total.
- If a step has a red cross, select it, copy the error and paste it into the Flow Doctor.
Things to watch
- Extracted values can be wrong. Check totals before paying.
Or let AutomateAlong build it alongside you
This flow is a template in AutomateAlong: open it in the builder and it walks you through the same steps one at a time, with a Copy button on every value, readiness checks, and improvement ideas (error handling, duplicate checks) you can add with one click. Free, no card needed.
Related
- How to save email attachments to SharePoint with Power Automate
- How to post Microsoft Forms responses to a Teams channel with Power Automate
- How to copy Excel rows into a SharePoint list with Power Automate
- How to send a weekly Teams reminder with Power Automate
- How to build a holiday request approval flow in Power Automate
AutomateAlong is independent and isn't affiliated with Microsoft. Microsoft and Power Automate are trademarks of the Microsoft group of companies.