Dear Microsoft Power Automate Community,
The company I work for is currently looking into possibilities to automate repetitive tasks to free up time for other tasks. One of the scenarios that I am working on is the following:
Our export department plans about 9,000 air and 4,000 sea freight shipments per year which are handed over to our contracted freight forwarders. For each air and sea shipment we receive an Air Waybill, respectively Sea Waybill in a PDF format from the freight forwarders by e-mail. Our staff members open each e-mail, then open the PDF file to check the country of destination, click save attachment as, select the correct SharePoint folder (there is a specific folder for each country), rename the file (file name is our shipment number) and save the file.
That takes around 1 minute or so per file. That's 13k minutes or about 217 hours a year spent on simply saving files to SharePoint!
I already managed to create a small scale PA flow that works: When an e-mail arrives from the freight forwarder which includes an attachment and the mail subject includes e.g. "AWB" the attachment is saved to the SharePoint. The recognize text in PDF function reads the file and based on a condition, if the recognized text contains e.g. "Taiwan" as country of destination, the file is moved to the correct SharePoint folder for the relevant country, or, if the first condition is not true, check the 2nd condition which is true if the recognized text contains e.g. "Thailand" as country of destination and so on.
However, what concers me, is that this flow with just 2 conditions takes about 2-4 minutes to complete. We supply over 100 countries so I would have to add more than 100 conditions to this flow, one for each country for the files to be moved to the correct SharePoint folder. So I wonder whether setting so many conditions is the right approach, as it may take a long time for the flow to go through each condition (performance concerns), and if there is a better way to automate this process?
What I have not yet tackled is to rename the file with the actual shipment number. The shipment number is either mentioned in the e-mail subject but is also mentioned in the PDF file itself. Getting it from the PDF file itself would be the safer approach. It is a 7-digit number and I am not sure how to isolate it from the rest of the recognized text and how to get PA to use that number as the new file name.
In short I have two questions:
1) What is the best practice approach to have PA identify the country of destination per file and move the file to the correct SharePoint folder also taking performance into account?
2) How to extract the shipment number from the PDF to rename the PDF file on SharePoint?
Thank you so much in advance for your input.
Regards,
Tobias