Forum Discussion
Remove Emojis from Open Text Field
Hi CharleyKirton ! I am also struggling to get this to work with both emojis and emoticons but I did get to do it with another aproach:
let
// Define the input table
input = Table.FromRows({{"This text string contains some ๐ emojis."}, {"Another text string with ๐ some emoticons."}, {"This string contains some emojis/emoticons ๐ฃ๐๐ช๐พ๐พ"}}, {"TextColumn"}),
#"Run Python script" = Python.Execute(
"# 'dataset' holds the input data for this script
#(lf)#(lf)filter_char = lambda c: ord(c) < 256
#(lf)dataset['TextColumn'] = dataset['TextColumn'].apply(lambda s: ''.join(filter(filter_char, s)))",
[dataset=input]),
#"Expanded Value" = Table.ExpandTableColumn(#"Run Python script", "Value", {"TextColumn"}, {"Without_Emoji"}),
#"Removed Columns" = Table.RemoveColumns(#"Expanded Value",{"Name"}),
#"Changed Type" = Table.TransformColumnTypes(#"Removed Columns",{{"Without_Emoji", type text}})
in
#"Changed Type"
Please keep in mind that since this solution is based on a Python script in can increase the refresh times so please test this in your dataset before adopting it as a solution.
Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution โ๏ธ or giving it a kudoe ๐
Thanks!
You can also check out my LinkedIn!
Best regards,
Gonรงalo Geraldes
Aww - thank you for trying!!
Unfortunately when I said I'm using Power Query, it's actually as a dataflow (which later feeds an AI engine, so needs to remain a dataflow), so Python's not an option. **bleep**!! I really appreciate your help though!!
I'm now experimenting with this method: (402) Power Query: Bulk Replace Values from a table in Excel & Power BI - YouTube