Do you want to remove line breaks from text in Power Automate? Then, this Power Automate tutorial will help you to remove line breaks from text using flows with different examples.
Sometimes, we are in need to remove line breaks from text using Power Automate flow. For example, if we have values like below
Text1
Text2
Text3
We have to display the values below by removing line breaks from text using the flow.
Text1,Text2,Text3
Here, I will explain two different examples of how to remove line breaks from text using the Replace() function in Power Automate.
In this first example, I will show you how to remove line breaks from text using Power Automate flow.
In the second example, I will show you how to remove line breaks from text presented in multi-line text filed in the SharePoint list using Power Automate flow.
Now, we will create a flow to remove line breaks from text using Power Automate flow.
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)
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
Step-2:
Now, to remove line breaks from text, Add a compose data operation and pass the below expression:
replace(variables('Technologies'),decodeUriComponent('%0A'),';')
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.
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
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
Step-2:
Add a new step, choose Apply to each control, and pass the value from the dynamic content
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'])
Now add another compose data operation to replace the line breaks into a single line
replace(outputs('Compose'),'%0A%0A','%0A')
Now, decode the result of the previous Compose data operation.
decodeUriComponent(outputs('Compose_2'))
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'),',')
Now, we will update the Description field after removing line breaks from it.
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')
Step-3:
save and run the flow once the flow runs successfully like below:
we can see it removes the line break for the text in the Description field presented in the SharePoint list.
This is how to remove line breaks from text presented in multi-line text filed in the SharePoint list using flow.
Conclusion
I hope you got an idea to remove line breaks from text using Power Automate flow.
So here, I explained to you two different examples of how to remove line breaks from text using the Replace() function in Power Automate. In this first example, I showed you how to remove line breaks from text using Power Automate flow. In the second example, I explained to you how to remove line breaks from text presented in multi-line text filed in the SharePoint list using Power Automate flow.
You may like the following tutorials:
- Replace Commas with New Lines in Power Automate
- Convert String to Float in Power Automate
- How to Format Number as Currency in Power Automate?
- Convert a String to a Decimal Number in Power Automate
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (9 times). I have also worked in companies like HP, TCS, KPIT, etc.