cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sean
Community Champion
Community Champion

Query Editor - Split Column By #(lf) Line Feed

Looking for some help in Splitting a Column by Delimeter #(lf) Line Feed

(generated by ALT+Enter in Excel OR when the data source is a table in a webpage)

 

let
    Source = Excel.Workbook(File.Contents("C:\Split Column by Line Feed.xlsx"), null, true),
    Table1_Table = Source{[Item="Table1",Kind="Table"]}[Data],
    #"Changed Type" = Table.TransformColumnTypes(Table1_Table,{{"Area", type text}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type","Area",Splitter.SplitTextByDelimiter("#(#)(lf)", QuoteStyle.Csv),{"Area.1", "Area.2"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Area.1", type text}, {"Area.2", type text}})
in
    #"Changed Type1"

 

Split a Column by Line Feed.png

 

I found this post by Ken Puls but I can't seem to get it to work with the code above

 

Thanks! Smiley Happy

1 ACCEPTED SOLUTION
Sean
Community Champion
Community Champion

Okay here are the simple User Interface Steps to Split using Special Characters! Smiley Happy

 

Split a Column by Line Feed - How To.png

View solution in original post

2 REPLIES 2
MarcelBeug
Community Champion
Community Champion

Without reading all the details of your post, I see "#(#)lf" in your code and coincidentally I just came across the phenomenon: wheneve you enter a special character code like "#(lf)" in some UI text box, the code generated will change it in "#(#)lf".

You should adjust the code to "#(lf)".

Edit: now I read the post from Ken Puls and he mentions this phenomenon too.

 

After that, you won't be able to adjust the code via the small wheel right from the step name, but only via the formula bar or the advanced editor.

 

So far I know about 1 exception: when splitting columns by delimiter via the UI, in the popup under advanced options, you can check "Split using special characters": when you select a special character from the list, or enter your own special character, in both cases you must have that "Split using special characters" checked.

 

Edit 2: maybe you can use the Lines.ToText function.

 

Edit 3: another exception is the option "Replace Values" for text columns:

Replace Values using special characters.png

 

Specializing in Power Query Formula Language (M)
Sean
Community Champion
Community Champion

Okay here are the simple User Interface Steps to Split using Special Characters! Smiley Happy

 

Split a Column by Line Feed - How To.png

Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors