How to Remove Line Breaks From Text in Power Automate?

I was working on a Power Automate project where the client asked me to remove the line break from a string using Automate. For example, if we have values like:

Text1
Text2
Text3

Then, I had to display the strings below by removing line breaks as:

Text1,Text2,Text3

This was possible using the Power Automate replace function.

In this article, I will explain how to remove line breaks from text in Power Automate with different examples.

Remove Line Breaks From Text in Power Automate

Let us see how to remove line breaks from text using Power Automate flow,

Example -1: (Using String Values)

There are some strings like (Power Apps, Power Automate, Power BI) and I want to remove line breaks from it.

Step-1:

Create an instant cloud flow with a manual trigger. Add a new step and select initialize variable action. Provide the required parameters.

  • Name – Enter the variable name
  • Type – Choose the variable type as String
  • Value – pass the below string values.
Power Apps
Power Automate
Power BI
Power Virtual Agents
Power Pages
power automate remove line breaks from text

Step-2:

Now, to remove line breaks from text, Add a compose data operation and pass the below expression:

replace(variables('Technologies'),decodeUriComponent('%0A'),';')
remove line breaks from text using power automate

Step-3:

save and run the flow once the flow runs successfully like below:

In the screenshot below, we can see it removes the line breaks from text and displays the string value as expected in the outputs of the compose data operation.

remove line breaks from text using power automate flow

This is how to remove line breaks from text using Power Automate flow

Example -2: (Using SharePoint list)

In this example, we will see how to remove line breaks from text presented in multi-line text filed in the SharePoint list using flow.

Here, I am going to use the below Technologies SharePoint list, Consisting of

  • Technology – default title column
  • Description – Multi line of text type
How to remove line breaks from text using power automate flow

Now, we will create a flow to remove line breaks for the Description column presented in the SharePoint list.

Step-1:

Create an instant cloud flow with a manual trigger, select Get items action from action triggers, and configure the required parameters.

  • Site Address – select the SharePoint site address from the dropdown
  • List Name – choose the SharePoint list. Here, I have selected my technology list
How to remove line breaks from text using power automate

Step-2:

Add a new step, choose Apply to each control, and pass the value from the dynamic content

Example to remove line breaks from text using power automate

Select a new step and add a compose data operation to encode the original text from the description field presented in the SharePoint list.

encodeUriComponent(items('Apply_to_each')?['Description'])
Power Automate remove new line

Now add another compose data operation to replace the line breaks into a single line

replace(outputs('Compose'),'%0A%0A','%0A')
How to remove line breakers from text in Power Automate

Now, decode the result of the previous Compose data operation.

decodeUriComponent(outputs('Compose_2'))
Remove carriage return line break from string in Power Automate

Add a compose data operation to remove line breaks from text from the output of the previous compose data operation.

replace(outputs('Compose_3'),decodeUriComponent('%0A'),',')
power automate remove line breaks from string

Now, we will update the Description field after removing line breaks.

For that, Add a new step, choose the Update item action from action triggers, and provide the below parameters:

  • Site Address – select the SharePoint site address from the dropdown
  • List Name – choose the SharePoint list. Here, I have selected my technology list
  • ID – choose the ID from dynamic content values

In the Description field, pass the outputs of the compose data operation.

outputs('Compose_4')
power automate remove line breaks

Step-3:

save and run the flow once the flow runs successfully like below:

How to get rid of line breaks in text using Power Automate flow

We can see it removes the line break for the text in the Description field presented in the SharePoint list.

How to get rid of line breaks in text using Power Automate

This is how to remove line breaks in Power Automate from a multi-line text filed in the SharePoint list.

Conclusion

I hope you have an idea of how to remove line breaks from text using Power Automate.

Also, you may like the following tutorials:

>

Build a High-Performance Project Management Site in SharePoint Online

User registration Power Apps canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial FREE PDF Download

FREE Power Platform Tutorial PDF

Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…