web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Optimizing Data Extrac...
Power Automate
Unanswered

Optimizing Data Extraction and Matching Logic for Invoice Processing in PAD

(0) ShareShare
ReportReport
Posted on by 78

Here is a brief overview of what I am trying to achieve: extracting data from a PDF and matching the text in specific Excel cells, while also incorporating some logic. This step is necessary because, unfortunately, the text cannot be directly matched. In the invoice section listing the items, we have lines like : 

`

1312.124.222.001 10 10.50

8080.080.221.002 5 19.25

7070.321.111.003 1 25.43

`

, where the last three digits of the item number (1312.124.222.001) signify the country of origin.

At the bottom of the invoice, the information is presented in separate rows, such as

`

Germany 001

Italy 002

France 003

`

For instance, 002 corresponds to Italy. I have created a datatable to store the invoice rows, for instance, `[['ItemN', 'Q.ty', 'UnitP', 'CountryO'], ['1312.124.222', '10', '10.50', '001'], ...]`.

 

I have already acomplished the first part of the logic using regular expressions, foreach loops, and other logic.

Next, I need to replace the country of origin codes in the datatable with the actual country names, like changing 001 to Germany, 002 to Italy, 003 to France, etc.

Now, I need a bit of help to finalize the logic in the simplest possible way.

Firstly, how should I proceed with the country of origin information? Would it be better to store them in another datatable like `[['CountryCode', 'Country'], ['001', 'Germany', ...]]` and then use two foreach loops, the first to cycle through the first datatable, and after extracting the CountryO information, start a second foreach loop to search the second datatable for a match? If so, given that the previous information was in multiple rows like "Germany 001", how can I write them directly inside the datatable?

Do I need to split the text somehow, or what? It seems too complex, and I want to simplify it.

Any ideas?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 298 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 289

#3
Henil Profile Picture

Henil 125

Last 30 days Overall leaderboard