Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Compose output missing new lines

(0) ShareShare
ReportReport
Posted on by 435

Hello again,

 

I am working on a flow that emails a few fields from a SP list item as a text file. The problem is, when the text file arrives, it's missing the new lines. Is there something I can do, to have the line returns carry over to the attachments?

 

 

1.jpg

2.jpg

 

  • Vlad1 Profile Picture
    16 on at
    Re: Compose output missing new lines

    Amazing, thank you so much!! I spent couple hours of struggling to find the solution 🙂

  • Ics_rthompsoneu Profile Picture
    25 on at
    Re: Compose output missing new lines
    What is "NL".

    Would you please show what is under the compose

    json('{"NL":"\r\n"}')?['NL']
  • Verified answer
    FoDelement Profile Picture
    435 on at
    Re: Compose output missing new lines

    Okay, I fixed it!

     

    The peek code is what helped me solve it. I noticed, it was sending returns as \n where as notepad requires them to be \r\n

    So this expression is what fixed it for me.

     

    json('{"NL":"\r\n"}')?['NL']
    Thank you for your help!
     
    2019-03-19 09_52_39-Start.jpg
     
     
  • FoDelement Profile Picture
    435 on at
    Re: Compose output missing new lines

     

    Glad to clarify it is not a Flow issue and the Flow works well as do you!

     

     


    Same result on the windows 7 machine.  For your carriage returns, you were not using anything fancy outside of pressing the enter key by chance, were you?

     

    {
     "inputs": "Why\nWont\nThis\nWork"
    }

    This is my input for the "Compose" action. (Using the peekcode function)

  • AlanPs1 Profile Picture
    2,471 on at
    Re: Compose output missing new lines

    Hi @FoDelement 

    I used Windows 10 in my testing last night.

    Yeah, looks like notepad in some way.

     

    My email is set up the same way although I have put text in the body as it is a mandatory field. But that is all.

     

    This posts - https://superuser.com/questions/362087/notepad-ignoring-linebreaks , seems to have additional information on the issue, you may have seen this already.

     

    Glad to clarify it is not a Flow issue and the Flow works well as do you!

     

    Thanks, Alan

  • FoDelement Profile Picture
    435 on at
    Re: Compose output missing new lines

    I just tried it again and got the same results. (Different PC, just to see if it was a notepad issue) 

     

    Is this how you have the email set up?

     

     

    Capture.PNG

    EDIT: I decided to test it a different way, this time creating a onedrive file, and I get the same result.

     

    2019-03-19 08_43_16-Run History _ Microsoft Flow.jpg

     

    So I decided to open the file with notepad++ and it has the returns!

    The issue seems to be with notepad, but I tried two different machines. The only common variable I can think of, is that they are both windows 10. I will test it on a windows 7 machine and see what happens.

  • AlanPs1 Profile Picture
    2,471 on at
    Re: Compose output missing new lines

    Hi @FoDelement 

    Sorry, I missed that. I though maybe the txt file was for demo purposes.

    Either way, I have recreated your Flow and have tested with values from a list and raw text in a compose as you have.Capture-384.png

    Both my text files have output with the carriage returns present:Capture-388.pngCapture-385.png

    and from the list data:Capture-387.png

    Capture-386.png

    Thanks, Alan

  • FoDelement Profile Picture
    435 on at
    Re: Compose output missing new lines
    Hello, and thank you for your reply.

    It is going to the email as an attachment. (In this case a .txt) so it does not support HTML.

    I did however try and do a "convert from HTML" and use that output for the attachment, to the same results.
  • AlanPs1 Profile Picture
    2,471 on at
    Re: Compose output missing new lines

    Hi @FoDelement 

    When you say "it's missing the new lines.", are you referring to the spaces you have created below, the carriage returns?:Capture-382.png

    Are you looking for your output to be:

     

    "William

     

    Sharpe" ?

     

    If so, set email to HTML and use <br> (or multiple <br><br>) for a line break or carriage return (in your Compose) is one easy way and the way I favour.

     

    If you have found my post helpful, please mark thumbs up.

    Any other questions, just ask.

    Thanks, Alan

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