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

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,685 Super User 2026 Season 1 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,685 Super User 2026 Season 1 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
    12,044 Super User 2026 Season 1 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 641

#2
Vish WR Profile Picture

Vish WR 640

#3
Haque Profile Picture

Haque 495

Last 30 days Overall leaderboard