web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Extract invoice inform...
Power Automate
Suggested Answer

Extract invoice information

(1) ShareShare
ReportReport
Posted on by 4
Hello, I receive invoices in PDF format from different providers, so the layouts and formats vary. I’m looking for a process or solution that can help me automatically extract the key information I need from these invoices and export it into an Excel file
I have the same question (0)
  • Vahid Ghafarpour Profile Picture
    797 Super User 2026 Season 1 on at
  • Suggested answer
    Riyaz_riz11 Profile Picture
    4,118 Super User 2026 Season 1 on at
    Hi,

    Invoice PDF Extraction - Power Automate Desktop Solution

    Overview

    This solution uses Power Automate Desktop to extract key invoice information from various PDF formats and export to Excel. It handles multiple layouts by using pattern matching and OCR capabilities.

     

    Main Flow Structure

    1. Setup and Configuration

    Variables to Initialize:
    - %InvoiceFolder% = "C:\Invoices\Input"
    - %OutputFolder% = "C:\Invoices\Output" 
    - %ExcelFile% = "C:\Invoices\InvoiceData.xlsx"
    - %ProcessedFolder% = "C:\Invoices\Processed"
    - %ErrorFolder% = "C:\Invoices\Errors"
     

    2. PDF Processing Loop

    Action: Get Files in Folder


    • Folder: %InvoiceFolder%

    • File filter: *.pdf

    • Include subfolders: No

    • Store into: %PDFFiles%

    •  

    Action: For Each (PDF File)

    For each %CurrentFile% in %PDFFiles%
        Call Subflow: ProcessSingleInvoice
        Parameters: %CurrentFile%
    End For Each

    Subflow: ProcessSingleInvoice

    Step 1: Extract Text from PDF

    Action: Extract text from PDF
    - PDF file: %CurrentFile%
    - Password: [Leave empty]
    - Extract all text: Yes
    - Store into: %ExtractedText%

    Step 2: Extract Invoice Information

     
    Action: Run Subflow
    - Subflow: ExtractInvoiceData
    - Parameters: %ExtractedText%, %CurrentFile%
    - Output: %InvoiceData%

    Step 3: Handle Extraction Results

    If %InvoiceData% contains valid data:
        Call Subflow: WriteToExcel
        Call Subflow: MoveToProcessed
    Else:
        Call Subflow: HandleError

    Subflow: ExtractInvoiceData

    Initialize Variables

     
    %InvoiceNumber% = ""
    %InvoiceDate% = ""  
    %VendorName% = ""
    %TotalAmount% = ""
    %TaxAmount% = ""
    %DueDate% = ""
    %PONumber% = ""

    Pattern Matching for Invoice Number

     
    Action: Parse text
    - Text to parse: %ExtractedText%
    - Text patterns: 
      - Invoice.*?:?\s*([A-Z0-9\-]+)
      - Invoice\s*#\s*([A-Z0-9\-]+)
      - INV\s*([A-Z0-9\-]+)
      - Bill.*?:?\s*([A-Z0-9\-]+)
    - Store into: %InvoiceNumber%

    Pattern Matching for Date

    Action: Parse text
    - Text to parse: %ExtractedText%
    - Text patterns:
      - Date.*?:?\s*(\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4})
      - Invoice\s*Date.*?:?\s*(\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4})
      - (\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4})
    - Store into: %InvoiceDate%
     

    Pattern Matching for Vendor Name

     
    Action: Parse text
    - Text to parse: %ExtractedText%
    - Text patterns:
      - From.*?:?\s*([A-Za-z\s&.,]+)
      - Vendor.*?:?\s*([A-Za-z\s&.,]+)
      - Bill\s*From.*?:?\s*([A-Za-z\s&.,]+)
    - Additional processing: Take first 3 lines after match
    - Store into: %VendorName%

    Pattern Matching for Total Amount

    Action: Parse text
    - Text to parse: %ExtractedText%
    - Text patterns:
      - Total.*?:?\s*\$?(\d+\.?\d*)
      - Amount.*?Due.*?:?\s*\$?(\d+\.?\d*)
      - Balance.*?:?\s*\$?(\d+\.?\d*)
      - Grand\s*Total.*?:?\s*\$?(\d+\.?\d*)
    - Store into: %TotalAmount%

    Pattern Matching for Tax Amount

    Action: Parse text
    - Text to parse: %ExtractedText%
    - Text patterns:
      - Tax.*?:?\s*\$?(\d+\.?\d*)
      - VAT.*?:?\s*\$?(\d+\.?\d*)
      - GST.*?:?\s*\$?(\d+\.?\d*)
    - Store into: %TaxAmount%

    Pattern Matching for Due Date

     
    Action: Parse text
    - Text to parse: %ExtractedText%
    - Text patterns:
      - Due.*?Date.*?:?\s*(\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4})
      - Payment.*?Due.*?:?\s*(\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4})
    - Store into: %DueDate%

    Pattern Matching for PO Number

    Action: Parse text
    - Text to parse: %ExtractedText%
    - Text patterns:
      - PO.*?:?\s*([A-Z0-9\-]+)
      - Purchase.*?Order.*?:?\s*([A-Z0-9\-]+)
      - P\.O\..*?:?\s*([A-Z0-9\-]+)
    - Store into: %PONumber%

    Subflow: WriteToExcel

    Check if Excel File Exists

     
    Action: If file exists
    - File: %ExcelFile%
    - If True: Open existing Excel
    - If False: Create new Excel with headers

    Create New Excel (If Needed)

     
    Action: Launch Excel
    - Launch Excel with a blank document: Yes
    - Store into: %ExcelInstance%
    
    Action: Write to Excel worksheet
    - Excel instance: %ExcelInstance%
    - Write mode: Write to specified cell
    - Cell: A1
    - Value: Invoice Number
    - Store into: %ExcelInstance%
    
    Action: Write to Excel worksheet
    - Cell: B1, Value: Invoice Date
    - Cell: C1, Value: Vendor Name  
    - Cell: D1, Value: Total Amount
    - Cell: E1, Value: Tax Amount
    - Cell: F1, Value: Due Date
    - Cell: G1, Value: PO Number
    - Cell: H1, Value: File Name
    - Cell: I1, Value: Processing Date

    Find Next Empty Row

     
    Action: Read from Excel worksheet
    - Excel instance: %ExcelInstance%
    - Retrieve: All available values from worksheet
    - Store into: %ExcelData%
    
    Action: Set variable
    - Variable: %NextRow%
    - Value: %ExcelData.RowCount + 1%

    Write Invoice Data

    Action: Write to Excel worksheet
    - Excel instance: %ExcelInstance%
    - Cell: A%NextRow%, Value: %InvoiceNumber%
    - Cell: B%NextRow%, Value: %InvoiceDate%
    - Cell: C%NextRow%, Value: %VendorName%
    - Cell: D%NextRow%, Value: %TotalAmount%
    - Cell: E%NextRow%, Value: %TaxAmount%
    - Cell: F%NextRow%, Value: %DueDate%
    - Cell: G%NextRow%, Value: %PONumber%
    - Cell: H%NextRow%, Value: %Path.GetFileName(CurrentFile)%
    - Cell: I%NextRow%, Value: %DateTime.Now%

    Save and Close Excel

    Action: Save Excel
    - Excel instance: %ExcelInstance%
    
    Action: Close Excel
    - Excel instance: %ExcelInstance%
     
    If I have answered your question, please mark it as the preferred solution ✅ . If you like my response, please give it a Thumbs Up 👍.
    Regards,
    Riyaz
     
  • Suggested answer
    takolota1 Profile Picture
    4,980 Moderator on at
    If you OCR the text of files & feed it to a GPT mini prompt then you can extract whatever data you want for any format given & you get 1000 pages processed per month with the $15 per month Power Automate per user license.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 573

#2
Valantis Profile Picture

Valantis 407

#3
11manish Profile Picture

11manish 387

Last 30 days Overall leaderboard