Announcements
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.
Variables to Initialize: - %InvoiceFolder% = "C:\Invoices\Input" - %OutputFolder% = "C:\Invoices\Output" - %ExcelFile% = "C:\Invoices\InvoiceData.xlsx" - %ProcessedFolder% = "C:\Invoices\Processed" - %ErrorFolder% = "C:\Invoices\Errors"
For each %CurrentFile% in %PDFFiles% Call Subflow: ProcessSingleInvoice Parameters: %CurrentFile% End For Each
Action: Extract text from PDF - PDF file: %CurrentFile% - Password: [Leave empty] - Extract all text: Yes - Store into: %ExtractedText%
Action: Run Subflow - Subflow: ExtractInvoiceData - Parameters: %ExtractedText%, %CurrentFile% - Output: %InvoiceData%
If %InvoiceData% contains valid data: Call Subflow: WriteToExcel Call Subflow: MoveToProcessed Else: Call Subflow: HandleError
%InvoiceNumber% = "" %InvoiceDate% = "" %VendorName% = "" %TotalAmount% = "" %TaxAmount% = "" %DueDate% = "" %PONumber% = ""
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%
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%
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%
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%
Action: Parse text - Text to parse: %ExtractedText% - Text patterns: - Tax.*?:?\s*\$?(\d+\.?\d*) - VAT.*?:?\s*\$?(\d+\.?\d*) - GST.*?:?\s*\$?(\d+\.?\d*) - Store into: %TaxAmount%
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%
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%
Action: If file exists - File: %ExcelFile% - If True: Open existing Excel - If False: Create new Excel with headers
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
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%
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%
Action: Save Excel - Excel instance: %ExcelInstance% Action: Close Excel - Excel instance: %ExcelInstance%
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.
Congratulations to our 2026 Super Users!
Congratulations to our 2025 community superstars!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Haque 573
Valantis 407
11manish 387