Power Community

Power Community

Invoice scanning process Automation – Using Power Automate And AI Builder



Scannable invoices are an important part of the accounts payment process because they make it easier to process and find paper invoices. As companies deal with more and more bills, it becomes clear that they need to automate the process.  


Sometimes we need to push invoice data to accounting system, also for reporting and need to send messages to vendors and customers, this scanning process will help.  


Power Automate and AI Builder, two tools from Microsoft’s Power Platform, work well together to make this process faster and better. 


Power Automate is a service that helps create automated workflows between your apps and services to synchronize files, get notifications, collect data, and more. AI Builder, on the other hand, is a turnkey solution that brings the power of Microsoft AI to Power Automate, enabling organizations to automate processes and glean insights from their data through machine learning models. 


Setting Up Invoice Scanning Automation 

Before diving into automation, ensure that all necessary components are in place. This includes access to Power Automate, AI Builder, and any additional tools or services required for the specific workflow. 

Go to Power Automation dashboard, click on AI model. 





And selected prebuild model – “Extract Information from Model”. This model is already trained to extract information from invoices. Once you select this model and use it for scanning it will be able to extract information from most of the invoices.  


But incase if you have customer or complex formatting in your invoice document. You can customize this model accordingly.  




You will find the upload bottom to upload your document and see accuracy you will get with this model. Apart from that you will get two buttons “User prebuild model” and “Create custom model”. 


Prebuild model if you find good accuracy with existing model you can directly use this model in your flow. If you want to customize it a little bit according to your requirements, you can select Create custom model. In this case you need to train this model with your current invoice format.  




When you click on User this model in Power Automate it will ask you to create triggered based Power flow along with AI build model.  






This module will run a button click read information from pdf and send an email to user. You need to specify a username and password for all these apps before moving forward. Create the flow that automatically picks up the name ‘Read information from invoices. You can use the same name or modify it accordingly.  



Exploring Power Automate Flow –  


Step 1 – The first setup of flow is manual trigger which use to collect file. Where you can change input according to your need. By default it has file upload input along with some file type limited.  






Step 2 – Use to extract information from PDF using the same AI builder model that was picked before to use in the model. It will automatically embedded in the flow.  





Step 3 – Add an action step to create html table. Where in parameters you will get two options. Option 1 is to automatically create a table when you do not need to map any parameters. What comes from responses will be converted into an HTML table. Another option is custom which is used to create a custom HTML table and map values coming from previous steps.  






In our case, it is creating a table for Description, Quantity, and Amount coming in response to AI build invoice scanning step.  


Step 4 – Add action step to get logged user office profile. Which can be used in the next step to send email.  






Step 5 – Send email using Office 365 office connector and use action ‘Send an Email (V2)’. 


Use code like –  



  “type”: “OpenApiConnection”, 

  “inputs”: { 

    “parameters”: { 

      “emailMessage/To”: “@outputs(‘Get_my_profile_(V2)’)?[‘body/mail’]”, 

      “emailMessage/Subject”: “Invoice processed”, 


Congratulations @{outputs(‘Get_my_profile_(V2)’)?[‘body/givenName’]}! Your Power Automate flow ran successfully. Here are some of the fields extracted from the attached invoice by AI Builder Invoice Processing:
nInvoice ID
: @{outputs(‘Extract_information_from_invoices’)?[‘body/responsev2/predictionOutput/result/fields/invoiceId/valueText’]} (confidence score: @{outputs(‘Extract_information_from_invoices’)?[‘body/responsev2/predictionOutput/result/fields/invoiceId/confidence’]})
Invoice Date, as written on the invoice: @{outputs(‘Extract_information_from_invoices’)?[‘body/responsev2/predictionOutput/result/fields/invoiceDate/valueText’]} (confidence score: @{outputs(‘Extract_information_from_invoices’)?[‘body/responsev2/predictionOutput/result/fields/invoiceDate/confidence’]})
Invoice Date, in standardized date format: @{outputs(‘Extract_information_from_invoices’)?[‘body/responsev2/predictionOutput/result/fields/invoiceDate/valueDate’]}
Invoice Total, as written on the invoice: @{outputs(‘Extract_information_from_invoices’)?[‘body/responsev2/predictionOutput/result/fields/invoiceTotal/valueText’]} (confidence score: @{outputs(‘Extract_information_from_invoices’)?[‘body/responsev2/predictionOutput/result/fields/invoiceTotal/confidence’]})
Invoice Total, in standardized number format: @{outputs(‘Extract_information_from_invoices’)?[‘body/responsev2/predictionOutput/result/fields/invoiceTotal/valueNumber’]}
Line items:
nLearn more about AI Builder Invoice Processing and the information it can extract:


      “emailMessage/Attachments”: [ 


          “Name”: “@string(triggerBody()?[‘file’]?[‘name’])”, 

          “ContentBytes”: “@triggerBody()[‘file’][‘contentBytes’]” 




    “host”: { 

      “apiId”: “/providers/Microsoft.PowerApps/apis/shared_office365”, 

      “connection”: “shared_office365”, 

      “operationId”: “SendEmailV2” 



  “runAfter”: { 

    “Get_my_profile_(V2)”: [ 




  “metadata”: { 

    “operationMetadataId”: “a1d3dbef-cdb5-4a84-9c91-290ee0e1e667” 



This code to send email along with PDF information.  







Testing –  

Run flow ‘Read information from invoices’ using the details page. It will ask for an Invoice PDF to …





You will receive email on your logged email in HTML format which we used in Flow – 





I got this email at end of the process –  


“Sandeep! Your Power Automate flow ran successfully. Here are some of the fields extracted from the …




Web Design This is a sample description … 





It worked. Wow! 










Invoice scanning automation, powered by Power Automate and AI Builder, offers a powerful solution to streamline the accounts payable process, enhancing efficiency, accuracy, and cost-effectiveness. 


In this article we learnt – 

  1. How to train AI models in simple and effortless way  
    1. Extract data from model compose HTML 
      1. Send email along with HTML reporting embedded with invoice data 


        As technology continues to evolve, so will the capabilities and applications of automated invoice processing. Businesses that adopt and continuously improve their automation strategies will be well-placed to reap the benefits. 


This post was originally published on this site

- Advertisement -spot_img


Please enter your comment!
Please enter your name here

- Advertisement - Advertisement

Latest News

Announcing SharePoint Embedded General Availability

Authored by: Zach Rosenfield Today we’re pleased to announce the general availability of SharePoint Embedded, a new way to build...

More Articles Like This

- Advertisement -spot_img