Power Automate: Easily Replace New Line in Flow Expression
When recently working on a flow to do some data transformations to convert a CSV file into a JSON array, I had to find a way to replace the new line character from the string.
My initial thought was, this should be very easy to do using replace function
For example, consider this below variable that has new line characters.
We could than specify a simple replace as below
But surprisingly this doesn't work
After searching the internet for some time, there wasn't a straightforward way to do this and, you need to rely on initializing a variable to store the newline character and using replace as described here
Luckily, I noticed that using the trim function is all we need to easily replace the new line characters.
Hopefully the replace function gets fixed and we don't have to rely on the trim function.