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 / Extracting specific te...
Power Automate
Unanswered

Extracting specific text from over 500 PDF files

(0) ShareShare
ReportReport
Posted on by 508

My task is to extract specific information from over 500 PDF documents.  I tried using RegEx, admittedly I am new at using it.  I was able to get some data out but was not reliable as there are various versions of RegEx and some of then dont take some escape keys such as the \K.  

 

Is there a different way to parse out specific sections of thes PDF documents for example.  In the scenario below I want to extract the whole sentance anytime PowerAutomate sees a dollar value and then put it in excel.  Is there a different way to cut this data out.  I do not have any premium connectors, just a disclaimer. 

 

Does anyone have experience with this?

 

So the parse would look like this.  "During the Initial Term, Empoyee will be paid base compensation at the fixed rate of $90,000 per annum ("Fixed Compensation".

 

Can someone show me if this is possible?

 

 

VeeLearnMSFT_0-1641661921738.png

 

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Extract Text from PDF

    Parse Text by period

    For each CurrentItem in ParsedText

        If %CurrentItem% equals “Compensation”

            Set %ParsedText[CurrentItem.Index + 2] to %NeededText%

            Exit Loop
        EndIf

    Next

     

    I say + 2 because by the above format delimited by “.” You have compensation, initial term, and then the sentence you want.

     

    good luck!

  • VeeLearnMSFT Profile Picture
    508 on at

    Michael, I am sorry to be a super novice but can you show me a screenshot of this as to how to accomplish this.  I am very very new and really learning painfully slow. I am trying, really trying, but I am the only person in my organization that is even playing with this software so I have no one to bounce things off of.  I am sorry but it will really help me.  Sorry again.

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Of course. Unfortunately, I’m not a my computer until tomorrow. 

    ‘Extract Text from PDF’, and ‘Parse Text’ I believe are the correct action items. Try extracting the one page that your text is on to its own PDF first, just to make it easier and faster to practice against.  We can talk more on Monday. 

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Okay, so I had to change a couple things.  1) it is 'Split Text' not Parse Text 2) I used Loop instead of For Each, so I could reference the LoopIndex I was on.  Let's walk through it:

     

    MichaelAnnis_0-1641823704780.png

     

    Get the file to a variable.  If you want, you can do this with multiple files, but lets just start with getting what you need out of one.  

     

    Extract Text from PDF is pretty simple, just make sure you have the right file.  The first file in "Get Files" is %Files[0]% where %Files% is the list of files and [0] represents the first index of that list.  This will extract all text out of the PDF into a single text value.

     

    Split Text:  here you can split the %ExtractedPDFText% into a %TextList% based on any delimiter you choose.  I believe for your example above, "." is a great delimiter (assuming none of the contracts say "$90,000.00" instead of "$90,000".  If they do, we can look at other options, because this method will get cut off at the "." in "$90,000.00".

     

    MichaelAnnis_4-1641824529659.png

     

    So, now you have a %TextList% with everything between each "." on a separate index number, so we Loop looking for Compensation.  Remember, the first index is always 0, so we Loop 0 to %TextList.Count% increment of 1.  That looks like this:

     

    MichaelAnnis_1-1641824184066.png

     

    Then we say, If %TextList[LoopIndex]% contains "Compensation":

    MichaelAnnis_2-1641824273647.png

    Set Variable %TextList[LoopIndex + 2]% (note, mine was + 3; my PDF looks a little different and wanted to pull something else).

     

    MichaelAnnis_3-1641824361508.png

    Finally, once we have found what we needed, Exit Loop, and our %NeededText% variable should have the text we are looking for (two period sets after "Compensation").

     

    Best of luck!

  • VeeLearnMSFT Profile Picture
    508 on at

    Thank you. I will try and let you know.  Is this a better option than RegEx?  When I struggled using RegEx it seemed a bit more finnicky.  

     

    Thank you again.

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    It depends on how structured the contracts are.  I am not very familiar with RegEx, but I know it's exceptional if you understand how to use it.  I haven't taken the time.  I usually Google what I need and have only ever used it twice.

     

    This method will work, if all the contracts are "Compensation" then "." then "." then everything you need before the next "."

     

    There are other ways you could beef this up, for example, if it always starts with "Compensation" and ends with "Compensation")" then we could get the index for Compensation and Compensation") and then pull everything together that was between.

     

    So, if Compensation is 56, set to %Index1% and Compensation") is 59 set to %Index2%, we could say:

    MichaelAnnis_0-1641826108747.png

    MichaelAnnis_1-1641826272494.png

     

    Note:  I used Capital Contribution instead of Compensation") for the test of my PDF, but this worked perfectly.  So, you just need to find a specific starting and ending to all the contracts and be able to work PAD to support that and pull what you need.

  • VeeLearnMSFT Profile Picture
    508 on at

    Thank you Michael.  I will try this out.  In order for me to get this I have to just rollup the old sleeves.  I have no training in this software so it is a painful "YouTube", Forums, and Google process.   I did find a chat line for RegEx in which I was able to get further but you really have to know RegEx as you have to be very very very explicit and detailed to tell it what you need.  This was my frustration and I could not get what I needed since I had to account for any type of scenario such as space no space, hyphen, no hyphen, comma no comma.  If it has a hard return, there was a way to adjust for that.  It was endless. I hope this gives me an additional method to get what I need.  Thanks again for being so nice to respond and offer a solution.

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 227 Super User 2026 Season 2

#2
David_MA Profile Picture

David_MA 213 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 151

Last 30 days Overall leaderboard