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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Extracting a part of t...
Power Automate
Unanswered

Extracting a part of text from the extracted text from the pdf file and converting it to a numerical value in Power Automate Desktop

(0) ShareShare
ReportReport
Posted on by

Hello,

 

I need to extract a part of the text from the extracted PDF files in Power Automate Desktop. At this example is "10.797.000" and then change it to the number. That text has a variable value (different lines, different lenght and different values). It always occurse after word "przetarg".

 

How can I made it using PAD functions?

PAD2.jpgPAD3.jpg

 

I have the same question (0)
  • WillSG Profile Picture
    352 Moderator on at

    Hi @manoman  I hope you are doing well.

     

    You can use the for Each to read each line from the PDF file and one you have found which one have your Keyword "przetarg", you can use the Parse text Action with a Regex approach to get the specific value, Regex Code: \d{1,3}(?:\.\d{3})*

     

    Here is a snippet code to test this and is working like a charm.

     

    Variables.CreateNewList List=> List

    SET NewVar TO $'''and then change it to the number przetarg9.797.000.8.778.049ccurse after word'''

    Variables.AddItemToList Item: NewVar List: List

    LOOP FOREACH CurrentItem IN List

        IF Contains(CurrentItem, $'''przetarg''', True) THEN

            SET KeywordFound TO CurrentItem

            EXIT LOOP

        END

    END

    Text.ParseText.RegexParseForFirstOccurrence Text: KeywordFound TextToFind: $'''\\d{1,3}(?:\\.\\d{3})*''' StartingPosition: 0 IgnoreCase: False OccurrencePosition=> Position Match=> Match

    Display.ShowMessageDialog.ShowMessage Message: $'''Final Extraction: %Match%''' Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: True ButtonPressed=> ButtonPressed

     

    Please let me know if it works, happy automation!,


    If I have addressed your inquiry successfully, kindly consider marking my response as the preferred solution. If you found my assistance helpful, a 'Thumbs Up' would be greatly appreciated.

     

    Additionally, if you have any questions, feel free to DM me, and we can initiate a discussion.

     

    Kind regards,

     

    Will SG

    Managing Director & Automation Lead

    RAMS CR (Recruitment & Automation)

    LinkedIn Profile

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Use the Parse text action with regular expressions enabled to retrieve it based on the keyword. 

    The action should look like this:

    Agnius_1-1708705359430.png

     

    Make sure you parse the variable where your text is stored. Use (?<=przetarg\s)[\d\.]+ as the text to find, and enable regular expressions. Then you'll get your number in %Match%. You can then do the conversion you need.

     

    You can copy and paste the following code directly to PAD to create the action for you:

    Text.ParseText.RegexParseForFirstOccurrence Text: ExtractedPDFText TextToFind: $'''(?<=przetarg\\s)[\\d\\.]+''' StartingPosition: 0 IgnoreCase: False OccurrencePosition=> Position Match=> Match

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 523 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 406 Moderator

#3
abm abm Profile Picture

abm abm 245 Most Valuable Professional

Last 30 days Overall leaderboard