September 19, 2024

Power Automate: extract text data from PDF and images into Excel with Cradl AI

Kavian Braanaas
Reading time: 5 min.
With the advent of AI OCR software, automating data extraction from PDFs and images with a variety of different layouts has never been easier.
Cradl AI's connector integrates seamlessly with Power Automate, offering a all-in-one solution for streamlining data extraction and validation tasks. Without the hassle of traditional OCR, RegEx, or hallucinating LLMs.

Steps:

  1. Clone a free AI model from Cradl AI
  2. Create an empty Excel sheet in One Drive
  3. Connect Power Automate with the Excel sheet
  4. Connect Power Automate with the Cradl AI Model
  5. Start extracting data and export it to the Excel sheet

Pre-requisites:

Clone an invoice model in Cradl AI

In this guide, we will clone Cradl AI's pre-trained «invoice model». This model achieves high extraction accuracy for most invoices without requiring any set up.

You are free to choose any AI model you like, including a custom AI model that you train from scratch on your own documents.

Sign in to your Cradl AI account and clone the invoice template model.

Edit the invoice template by adding or removing fields if necessary. In the video example below, we demonstrate removing IBAN and Line items from the model because they are unnecessary for our document needs.

Create an Excel sheet in One Drive

Open your preferred file manager that integrates with Power Automate. For this example, we're using OneDrive.

Create a new Excel sheet and add headers that correspond to the fields you want to extract from your documents. Select your columns and format them as a table.

Connect Power Automate with your Excel Sheet

Create an Instant Cloud Flow in Power Automate and set it to trigger when an HTTP request is received.

The primary action here is to add a row to an Excel table. This example demonstrates using the Microsoft Business account version of the action, but you can also use the regular version.

Connect Power Automate with your Cradl AI Model

Inside Cradl AI, select Power Automate as your export destination and copy the auto-generated JSON schema.

Return to your Power Automate trigger and paste the JSON schema into the Request Body JSON Schema input field. Copy the HTTP URL and choose "Anyone" from the "Who Can Trigger The Flow" dropdown.

Paste the HTTP URL into the "Power Automate Webhook URL" input field in Cradl AI.

Finally, within Power Automate, select your action, display all Excel table fields, and populate them with the corresponding Cradl AI fields. The Cradl AI fields will auto-suggest based on the JSON schema previously pasted into your trigger.

Parse documents and export to Excel

Begin extracting data from your documents. In Cradl AI, click "Run," upload several invoices, and wait for processing to complete.

Once processed, open the invoices in Validator to correct any errors (your corrections enhance the model over time). Then, click "Validate" to export to Power Automate.

Voilá! Your extracted data can now be found in your Excel sheet.