At Ignite this year Microsoft announced that anybody running Windows 10 can now use Power Automate Desktop for free. Power Automate Desktop empowers users to automate repetitive tasks they run on their Windows desktops. In this post I wanted to demonstrate some of its extensive capabilities by using Power Automate Desktop for Document Automation extracting the contents of invoice received as emailed PDFs, and using RPA, Robotic Process Automation, to enter the details into a legacy application.
I previously did a post where I used Forms Processing in AI Builder in combination with Power Automate Desktop for document automation. This scenario requires paid license to run and here I wanted to see if I could accomplish something similar using the free version of Power Automate Desktop.
Power Automate Desktop supports the automation of a range of tasks including
- Send and receive emails
- Extract data from websites
- Connect to databases and run SQL queries
- Write, copy files and folders
- Robotic Process Automation
Getting started with Power Automate Desktop
To get started with PAD you download it from here. Once installed, configure it to run under your account. If you are using a work or school account the PDA flows you created will be stored in your organisation’s default Dataverse environment. In this example I using a regular Microsoft account so my PDA flows will be stored under the apps folder on OneDrive. Click the New Flow option to create a new Flow and give it a name.
The Power Autoname Desktop designer will open and you can begin to add actions to your Flow.
Document Automation Flow
The first actions in my Document Automation Flow are to launch Outlook and retrieve emails with invoices attached. For the retrieve emails action, I have specified the outlook account to use and that only unread emails are to be processed. The email’s attachments are saved into the c:\invoices folder.
The next action is to get all the files in the c:\invoices folder. I used a *.PDF filter to avoid picking up any email signature graphics. A for each loop is then used to process each file.
Within the loop I used an “Extract Text from PDF” action to extract the text from the invoice PDF creating a variable with the text below
The Extract Text from PDF action is very good at extracting text from structured documents like invoices. The results resemble a named value pair list.
No 1 Patrick Street
Date: 6th Nov ’20
Due By: 4th Dec ’20
Purchase Order: PO 2020198391
VAT @ 21%: €1,050.00
Qty Descrip on Rate Total
1 Consultancy 5,000.00 5,000.00
Ireland VAT Number: A5340439
Now use Parse Text actions with a regular expression to extract the required data values from the extracted PDF text. I have used three Parse Text actions to get the invoice number, purchase order number, and total amount.
It is good practice to rename the variable where the match is stored as it makes it easier to follow when you use it later in the flow.
RPA – Robotic Process Automation
Now that we have extracted the required data from the invoice PDF we can utilize the RPA capabilities of Power Automate Desktop to enter these details into a legacy application. Power Automate Desktop allows you to record your mouse movements and data entry and use it in your Flow. Here I am calling a Win Forms application and in these scenarios I usually add the action to start the application manually before I begin recording.
To begin recording click the desktop recording option from the op of the designer.
Once the recorder opens start recording and the actions you carry out will be recordered
Once you click finish the recorded actions are added to your Flow. You should now edit the actions replacing the text in the recorded actions with the variables from the Parse Text actions.
The final step within the loop is to delete any files from the c:\invoices. Once the Flow process an email it is marked as read and so won’t be picked up the next time the Power Automate Desktop flow runs.
Hopefully, this post has demonstrated the power of Power Automate Desktop, pardon the pun. To summarise, I was able to create a flow to download invoices received via email as PDFs , extract the invoice data and use this to replicate a user entering it into a legacy application. I have only scratched the surface of what can be accomplished with Power Automate Desktop. There are a ton of other capabilities you can use for free and I would encourage you to give it a go.