다음을 통해 공유


AI Builder: Extract data from Invoice using Prebuilt Model

  • Introduction
  • Business Use case
  • Implementation
  • Test the flow
  • Summary

Introduction

AI Builder is a Power Platform capability that provides you the AI models to take leverage of artificial intelligence to optimize your business as well as automate process. We can either use the already existing prebuilt models that suits our needs to use the Power of AI in Power Apps or Power Automate or create our own custom AI models to suit some specific business needs. You can read more about AI Models in the Official documentation here. The out of the box pre built available models in AI Builder are:

  • Business card reader    
  • Category classification     
  • Entity extraction                   
  • ID reader
  • Invoice Processing          
  • Key phrase extraction    
  • Language detection              
  • Receipt processing            
  • Sentiment analysis                
  • Text recognition                    
  • Text translation      

In this article we will see how to use the Invoice Processing AI builder to extract Key invoice data from an invoice file.

Business Use case

We have a requirement where we have numerous invoice files uploaded to SharePoint Document library so as to use it as a repository. Manually opening each file and copying the required values to the a destination list for further processing is a cumbersome task. So as to automate this, we will use Power Automate so that , whenever a file is uploaded to the document library, it will use AI builder pre build model to extract the required information from the file and save it to a destination list.

Implementation

We will be using a document library named Invoices Library for uploading the invoice PDF files and another SharePoint List named Extracted Invoice with the below fields to store the extracted information.

We will move over to Power Automate and create an Automated flow that gets triggered when a file is created in the invoices library . We will also add an action Get file content to fetch the content of the uploaded file as it will be needed for use in the AI Builder action.

In the next step we will add the prebuilt AI model - Extracts information from invoices to the flow

AI Builder comes with its own licensing model . We can start off with AI Builder trial after you have a Power Apps, Power Automate, or Dynamics 365 license that allows us to create a Microsoft Dataverse environment. However to use on a production environment, the suggested way is to procure the required AI Builder credits which you can calculate using this tool from Microsoft.

Once the AI Builder action is added, we will provide the base64 encoded file content of the Get File Content action as the input to the AI Builder for invoice processing.

base64(outputs('Get_file_content_-_Extract_content_from_Invoice_PDF')?['body'])

The AI Builder action automatically fetches the information which has been predefined in its model by cross comparing the uploaded file and we can get 60+ information extracted from the file. For a detailed list of the Model outputs , please check this official documentation. For our scenario,we have fetched the dynamic output content from the AI Builder action and assigned it to the field values in the Create Item action which will create the list item and update the fields with the extracted information.

Thus the overall flow would look like below :

Test the flow

Now lets test the flow by uploading an invoice file to the library. This will trigger the flow and extract the information from the file as shown below :

It will also create an item in the destination list with the extracted values

Summary

Thus we saw how to use prebuilt AI Builder models to extract information from an invoice and save it back to a SharePoint List.