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 / Looping through Get Fi...
Power Automate
Unanswered

Looping through Get File Content

(0) ShareShare
ReportReport
Posted on by 12

Hi,

 

I'm reading a text file through Get File content.  Is it possible to read each line and search for the keyword ERROR. ? 

PranavPh_0-1687880273683.png

 

I want to build a loop where it reads line by line and if it finds the keyword ERROR then will proceed further in IF condition. 

 

I tried using apply each but I'm going wrong somewhere! 

 

Eg. This sample file has 3 rows with ERROR keyword so the loop will enter the IF case 3 times where I can do other actions. 

 

@ekarim2020 @Expiscornovus 

Regards,

Pranav 

 

Categories:
I have the same question (0)
  • Chriddle Profile Picture
    8,436 Super User 2025 Season 2 on at

    You can use function split() to split the file content at line breaks.

    https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#split

     

    Line break is decodeUriComponent('%0A')

  • PranavPh Profile Picture
    12 on at

    Hey, should I use the Split in Apply to each loop? I'm very new to power platform so can you show an example? 

     

    Regards,

    Pranav 

  • Verified answer
    Chriddle Profile Picture
    8,436 Super User 2025 Season 2 on at

    Yes, use this expression as the input of your Apply to each:

    split(output_of_your_file_content_action, decodeUriComponent('%0A'))

     

  • Verified answer
    Ellis Karim Profile Picture
    11,681 Super User 2025 Season 2 on at

    Just as an additional note, in some Windows text files each line could end with two characters: a Carriage Return (CR) and Line Feed (LF) characters:

    ekarim2020_1-1688078709159.png

    You can use apps such as NotePad++ to view these characters.

     

    So the file could also be split at the CRLF characters:

    split(body('Get_file_content'),decodeUriComponent('%0D%0A'))

     


    Ellis
    ____________________________________
    If I have answered your question, please mark the post as ☑️ Solved.
    If you like my response, please give it a Thumbs Up.
    My Blog Site

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard