Automating Invoice Processing with Power Automate

Sep 13, 2024

Invoice Processing Automation with Power Automate

Overview

  • Client: Burger company
  • Goal: Automate invoice processing from email attachments to Excel.
  • Tools: Microsoft Power Automate, AI Builder.

Input Data

  • Invoices saved locally (6 invoices provided).
  • Structure: Each invoice contains:
    • Invoice number
    • Date
    • Addresses
    • Total amount
    • Taxes
    • Table with items (varying number of rows)

Process Overview

  1. Download Invoices: Recommended to download all six invoices for practice.
  2. Structured vs Unstructured Data: Today's focus is on structured documents (same format). Unstructured data will be covered in future videos.

Creating the AI Model

  1. AI Builder: Navigate to AI Builder in Power Automate.
  2. Form Processing: Click "Build" and select "Form Processing".
  3. Model Setup:
    • Name the model (e.g., "Invoice Processing").
    • Specify fields to extract:
      • Invoice Number
      • Date
      • Total
      • Table items (single page table selection).
  4. Tagging the Data:
    • For each invoice, identify and tag the invoice number, date, total, and table items.
    • Ensure to correctly tag data on all five training invoices.
  5. Training the Model:
    • Upload the first five invoices.
    • Tag the necessary fields and table headers.
    • Train the AI model.

Creating the Power Automate Flow

  1. Create a Flow:
    • Choose an "Automated Cloud Flow".
    • Trigger: New email with attachments containing "invoice" in the subject.
  2. Set Up Loop:
    • Loop through each attachment in the email.
  3. Output to Excel:
    • Create an Excel workbook in OneDrive.
    • Define a table structure with headers: Invoice Number, Date, Total, Items.
    • Use the AI model to extract data from the invoices.
    • Add extracted data to the Excel table.

Testing the Flow

  1. Testing with Invoice Number Six:
    • Send an email with invoice number six attached to test the flow.
  2. Inspecting Results:
    • Upon successful run, data should appear in OneDrive Excel workbook.
    • Check and format the data as needed (e.g., currency formatting).

Final Steps

  • Review run history to check for errors and ensure data integrity.
  • Adjust JSON output if necessary to refine data formatting.
  • Ensure proper column mapping if rows need to be separated.

Additional Resources

  • For further learning, consider taking a full Power Automate course.