While working on a project named Employee Satisfaction Survey, I encountered a requirement to replace commas with new lines in Power Automate. Initially, I thought this could be easily achieved using the replace() function, which follows this format:
replace(text: string, oldText: string, newText: string)However, when I tried using \n, char(10), or even HTML <br> tags as the newText Value, they didn’t work as expected. After some research and testing, I found two easy ways to replace commas with new lines in Power Automate:
- Using a new line in a variable.
- Using a new line from an expression.
In this tutorial, I will walk you through both methods to effectively replace commas with new lines in Power Automate.
Replace Commas with New Lines in Power Automate Using Variable
Let’s see how to replace commas with new lines in Power Automate using a variable.
1. Create an Instant Cloud Flow by selecting the ‘Manually trigger a flow’ trigger action.

2. Now add Initialize variable action and provide the below parameters:
- Name: Provide like varPowerPlatform.
- Type: Select a string in the drop-down.
- Value: Provide the below value, or you can provide it as required.
Power App,Power Auomate,Power BI,Power Pages,Power Virtual Agent
3. Then add another Initialize variable action and provide the below parameters:
- Name: Provide like varLineBrack.
- Type: Select a string in the drop-down.
- Value: Leave as blank.

4. Add the Compose action and provide the below expression:
replace(variables('varPowerPlatform'),',',variables('varLineBrack'))
Now save the flow and run the flow manually. After the flow runs successfully, select the compose action output. You can see a new line has already replaced the commas.

Replace Commas with New Lines in Power Automate Using Expression
You have a SharePoint list named Employee Feedback, where employees submit their feedback. The “Suggestions” column is a multi-choice field, and when retrieved in Power Automate, the values appear as a comma-separated string like:
Better Work-Life Balance,More Training,Flexible Work HoursHowever, we want to store this data in another “Formatted Suggestions” column where each value appears on a new line for better readability.
To do this, follow the below steps:
1. Create an Automated Cloud Flow using the SharePoint connector’s When an item is created trigger. Select the SharePoint site where your Employee Feedback list is present, and choose the Employee Feedback list.

2. Add a compose action and provide the below expression to replace the comma with a new line:
replace(triggerBody()?['Suggestions'],',',decodeUriComponent('%0A'))- triggerBody()?[‘Suggestions’]: This retrieves the value of the Suggestions field from the trigger.
- replace(… , ‘,’, decodeUriComponent(‘%0A’)):
- replace(text, ‘,’, new_value): Replaces all occurrences of ‘,’ with the new value.
- decodeUriComponent(‘%0A’): Decodes
%0A, which represents a new line (line break).

Save the flow and run it manually. Then, go to the SharePoint list and add a new item.

After the flow runs successfully, check the compose action output section. You can see that the compass has now been replaced with a new line.

Conclusion
In this tutorial, I covered two easy ways to replace commas with new lines in Power Automate. First, I explained how to achieve this using a variable by initializing an empty string variable and using it in the replace() function. Then, I showed how to replace commas with new lines using an expression by leveraging decodeUriComponent(‘%0A’).
You may like the following tutorials:
- Convert String to Float in Power Automate
- Convert String to GUID in Power Automate
- Convert a String to an Integer in Power Automate
- Convert a String to a Decimal Number in Power Automate
- Compare Date Using Ticks Function in Power Automate
- Replace Apostrophe in String in Power Automate

After working for more than 18 years in Microsoft technologies like SharePoint, Microsoft 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 (12 times). I have also worked in companies like HP, TCS, KPIT, etc.