Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Remove "" line from end of string

(0) ShareShare
ReportReport
Posted on by 5

I have a flow which is extract each line from a text document into either a excel or SharePoint list.

 

Problem is, some of the text files that I will receive from external users may have a blank line after the last scan which is causing my flow to fail once it gets to the last row because it can't read the barcode after the 3rd comma because it doesn't exist.

 

Converted Text.png

Is there a way to wipe out that line with just the "" before i start looping each to feed the excel or list to prevent a failed flow run?

 

  • IllFigureItOut Profile Picture
    5 on at
    Re: Remove "" line from end of string

    @creativeopinion   That worked like a charm but now when I try and write values to excel or SharePoint I get the following error message when testing the flow. I assume I need to do some sort of conversion?

    String error.png

     

     

  • Verified answer
    creativeopinion Profile Picture
    10,450 Super User 2025 Season 1 on at
    Re: Remove "" line from end of string

    @IllFigureItOut The screenshot you've shared isn't a string, it's an array. You can filter out the empty items by using a Filter Array action.

     

    Insert the output from your Compose action into the from field. In the first value field, insert an expression and use the item() function.

    creativeopinion_0-1715267171203.png

     

    Change the operator to is not equal to and leave the second value field blank.

    creativeopinion_2-1715267241930.png

    Run a test.

    creativeopinion_1-1715267230479.png

    To learn more about how to use the Filter Array action, please refer to this YT Tutorial: Are you using the Microsoft Power Automate Filter Array Action wrong?

     

    In this video tutorial I’ll show you 3 practical ways to use the Filter Array action and how to use it properly.

    1️⃣ Cross-Referencing Data

    2️⃣ Filtering by Key

    3️⃣ Substring Matching

     

    Did you know that the Condition action has a limit of 10 conditions? Although it might look like the Filter Array action can only accept one condition—this is not true. By using the advanced mode you can enter multiple conditions into a Filter Array action with an expression.

     

    IN THIS VIDEO:

     3 Ways to Use the Filter Array Action

    How to use the Scope Action to Group Actions

    How to Check the Number of Items returned from a Filter Array Action

    How to Cross-Reference Data in Excel with a SharePoint List

     How the Filter Array Action Works

     How to Access the Dynamic Content from a Filter Array Action

     How to Filter Items by a Key

    How to Filter Items by Matching a Substring

    How to Use Multiple Conditions in a Filter Array Action

    Hope this helps!

    If I helped you solve your problem—please mark my post as a solution .
    Consider giving me a 👍 if you liked my response!

    👉 Level up your Power Automate skills by checking out my tutorials on YouTube
    👉 Tips and Tricks on TikTok and Instagram

     

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1