AI Builder: Extract data from Invoice using Prebuilt Model

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 processes. We can either use the already existing prebuilt models that suit 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 the SharePoint Document library so as to use it as a repository. Manually opening each file and copying the required values to the 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 an 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.

A picture containing graphical user interface

Description automatically generated

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.

Graphical user interface, text, application, email

Description automatically generated

In the next step, we will add the prebuilt ai model – Extracts information from invoices to the flow

Graphical user interface, application

Description automatically generated

AI Builder comes with its own licensing model. We can start off with an 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 in a production environment, the suggested way is to procure the required AI Builder credits which you can calculate using this tool from Microsoft.

Graphical user interface, text, application

Description automatically generated

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.

Graphical user interface, text, application, email

Description automatically generated

Thus the overall flow would look like below :

Graphical user interface, text, application, email

Description automatically generated

Test the flow

Now, let’s 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 :

Graphical user interface, text, application, email

Description automatically generated

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

Graphical user interface, text, application

Description automatically generated

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.

Related Articles

Author

Author

Priyaranjan KS is a Modern Workplace Architect primarily focused on developing and architecting solutions around Office 365,Power Platform and Azure.He is also a Microsoft Most Valuable Professional(MVP) and a Microsoft Certified Trainer(MCT)

Latest Articles