Skip to main content

Notifications

Power Automate - Power Automate Desktop
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

 

  • Agnius Bartninkas Profile Picture
    Agnius Bartninkas 10,045 on at
    Re: Extracting a part of text from the extracted text from the pdf file and converting it to a numerical value in Power Automate Desktop

    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

  • WillSG Profile Picture
    WillSG 350 on at
    Re: Extracting a part of text from the extracted text from the pdf file and converting it to a numerical value in Power Automate Desktop

    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

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

End of Year Newsletter…

End of Year Community Newsletter…

Tuesday Tip #12 Start your Super User…

Welcome to a brand new series, Tuesday Tips…

Tuesday Tip #11 New Opportunities…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 144,609

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,420

Leaderboard