admin管理员组

文章数量:1406178

I'm trying to replace all values in a column with the same values but in quotes

Examples

Words

words22

to

"Words"

"words22"

I tried doing things like with 'FileName' being the name of the column, but its just looking for the literal string '[Filename]' instead of the value in it.

= Table.ReplaceValue(#"Renamed Columns","[FileName]","""""[FileName]""""",Replacer.ReplaceText,{"FileName"})

I'm trying to replace all values in a column with the same values but in quotes

Examples

Words

words22

to

"Words"

"words22"

I tried doing things like with 'FileName' being the name of the column, but its just looking for the literal string '[Filename]' instead of the value in it.

= Table.ReplaceValue(#"Renamed Columns","[FileName]","""""[FileName]""""",Replacer.ReplaceText,{"FileName"})
Share Improve this question edited Mar 6 at 16:35 BigBen 50.2k7 gold badges28 silver badges44 bronze badges asked Mar 6 at 16:28 Alex KibbeAlex Kibbe 113 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 1

try

#"AddQuotes" = Table.TransformColumns(#"Renamed Columns",{{"FileName",each """" & _ & """", type text}})

You can use Table.ReplaceValue but with a custom Replacer:

= Table.ReplaceValue(
     #"Renamed Columns",
     each [FileName],
     null,
     (x,y,z)as text=>"""" & Text.Trim(y,"""") & """",
     {"FileName"})

本文标签: excelHow to wrap text in quotes using powerQueryStack Overflow