AutomateAlong

How-tos › Build a flow

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

  1. When a new email arrives · When a new email arrives (V3)
  2. For each attachment · Apply to each
  3. Inside the loop: Check if PDF · Condition
  4. If yes: Extract invoice data · Extract information from invoices
  5. 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.

BoxValueHow it goes in
Folder
Choose from the dropdown
InboxOpen the dropdown and choose "Inbox".
Only with Attachments
Choose from the dropdown
YesOpen the dropdown and choose "Yes".
Include Attachments
Choose from the dropdown
YesOpen 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.

BoxValueHow it goes in
Select an output from previous steps
Dynamic content
⚡ AttachmentsClick 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.

BoxValueHow 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 withOpen the dropdown and choose "ends with".
Right value
Type or paste it
.pdfClick 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.

BoxValueHow 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.

BoxValueHow it goes in
Location
Your own site, list or folder
OneDrive for BusinessPick your own from the dropdown (for example: OneDrive for Business).
Document Library
Your own site, list or folder
OneDrivePick your own from the dropdown (for example: OneDrive).
File
Your own site, list or folder
Invoices.xlsxPick your own from the dropdown (for example: Invoices.xlsx).
Table
Your own site, list or folder
InvoiceLogPick your own from the dropdown (for example: InvoiceLog).
InvoiceId
Dynamic content
⚡ Invoice ID valueClick in the box, select the lightning-bolt (Dynamic content) button, then under "Extract invoice data" pick "Invoice ID value".
Vendor
Dynamic content
⚡ Vendor name valueClick in the box, select the lightning-bolt (Dynamic content) button, then under "Extract invoice data" pick "Vendor name value".
Total
Dynamic content
⚡ Invoice total valueClick in the box, select the lightning-bolt (Dynamic content) button, then under "Extract invoice data" pick "Invoice total value".

Test it

  1. Select Save, then Flow checker and fix anything it lists.
  2. Select Test → Manually → Test, then do the thing that starts the flow (send the email, submit the form, or run it).
  3. 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.
  4. 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

AutomateAlong is independent and isn't affiliated with Microsoft. Microsoft and Power Automate are trademarks of the Microsoft group of companies.