Enhancing the Flow: Automating Document Summaries with Power Automate
In this blog post, we'll walk through an improved Power Automate flow that streamlines the process of uploading Word documents to Dataverse, extracting their content, and saving a summarised version directly back into Dataverse. This builds on the earlier blog post about using AI Builder for document summaries.
Step 1: Create a Dataverse Table
When creating your Uploaded Documents table in Dataverse:
Add a Document Name field.
Add an Attachments field (file data type).
Note: Fields like Created On and Created By are automatically included, so you don’t need to add those manually.
Step 2: Design Your Canvas App
Your canvas app should include:
A simple form for document uploads.
A submit button that writes the document data to the Uploaded Documents table.
Step 3: Build the Flow in Power Automate
In Power Automate, create a new flow with the following steps:
1. Trigger: When a Row is Added
Use the When a row is added trigger.
Select your Uploaded Documents table.
Set the Scope to Organisation to ensure the flow runs on all newly uploaded documents.
Tip: If you only want the flow to trigger for documents created by the logged-in user, you can change the scope to User.

2. Download the Uploaded File
Add a Download a file or an image action.
Select your Uploaded Documents table.
In the Row ID field, insert the Row ID from the trigger step.
In the Column Name field, select your Attachments column.
3. Extract Text with Encodian
Add the Encodian - Get Text from Word action.
In the File Content field, select the Body output from the previous step.
(Optional) Enable settings like Remove Comments or Remove Headers and Footers to clean up the extracted text.
Note: Encodian offers a free trial with a limit of 50 documents per month. You'll need to sign up and enter an API key in your flow.

4. Summarise the Text Using GPT
Add a Create Text with GPT action.
In the prompt field, enter instructions like:
"Summarise this text in under 2000 characters:"
Pass the extracted text from the Encodian step as input.
5. Update the Dataverse Row with the Summary
Add an Update a Row action.
Select your Uploaded Documents table.
For the Row ID, use the Row ID from the trigger step.
In the Summary field (a text field in your Dataverse table), insert the GPT-generated summary output.
Step 4: Testing and Debugging
To help with debugging, add a Compose action that outputs the generated summary text. This makes it easier to view results when testing your flow.
Key Differences from the Basic Version
This enhanced flow differs from the earlier version by:
Triggering automatically when a document is uploaded.
Extracting text directly from Word documents using Encodian.
Automatically saving the summarised text back into the Dataverse table.
With these improvements, document management becomes faster and more efficient. If you encounter issues or have questions, feel free to reach out. Happy building!
Comentarios