Replace carriage returns in a Power Query column?

Charley Kyd 1 Reputation point
2021-09-06T23:23:33.47+00:00

I can find no way to replace a carriage return in Power Query column. This SHOULD work:

Result=Table.ReplaceValue(QtrInc,"#(#)(cr)"," ",Replacer.ReplaceText,{"AcctName"})

But it has no effect.

Instead of "#(#)(cr)" I've tried:

"#(#)(000D)"
"#(cr)"
"#(#)(000D)"

But they have no effect. I tried to split the column on the character, but still no joy.

Is this a bug? Or have I blundered?

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
35,929 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Rusty Miles 11 Reputation points
    2021-10-04T20:49:15.57+00:00

    When #(cf) wouldn't work for me, #(lf) did work. ie Line Feed

    2 people found this answer helpful.

  2. Ron Rosenfeld 271 Reputation points
    2021-09-09T19:40:37.967+00:00

    "#(cr)" should work.

    Are you absolutely certain you have carriage-return characters in the string?
    When I try the replace here, it works flawlessly.

    1 person found this answer helpful.

  3. Ron Rosenfeld 271 Reputation points
    2021-09-10T00:49:31.927+00:00

    Just replace it with a space:

    eg:

    let  
        Source = Table.FromList(  
            {"abc" & Character.FromNumber(13) & "def"},  
            Splitter.SplitByNothing(),  
            {"Column1"}          
            ),  
      
        replaceCR = Table.ReplaceValue(Source,"#(cr)"," ",Replacer.ReplaceText,{"Column1"})  
    in  
        replaceCR  
    

    Source
    130922-image.png

    Replace CR
    130894-image.png

    0 comments No comments