Forum Discussion
ianbruckner
3 years agoFrequent Visitor
convert a column's data to list
I've seen a lot of examples of changing a list to a csv type format, but how do you go the other way? With this data: Header
{"A","B","C ee"}
{"A","D","C ee"} I'm hoping to end up wi...
- 3 years ago
Found it! A bit more complicated than I hoped for, but it works:
= Table.AddColumn(#"Changed Type", "Custom", each Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv)([Header]))Now if only I could remember how to do it "in column" where it replaces the value in the existing column instead of adding a new one, that'd save another step or two.
ianbruckner
3 years agoFrequent Visitor
Found it! A bit more complicated than I hoped for, but it works:
= Table.AddColumn(#"Changed Type", "Custom", each Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv)([Header]))
Now if only I could remember how to do it "in column" where it replaces the value in the existing column instead of adding a new one, that'd save another step or two.
Nruzicka
3 years agoNew Member
Hello, maybe a late reply but to transform your existing column to a list type without adding an additional column, try this method:
= Table.TransformColumns("tableName", {"ColumnName", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv)})The "transformOperation" argument in "TransformColumns" can have multiple operations. So if you want to convert multiple columns to a list type:
= Table.TransformColumns("tableName", {
{"column1", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv)},
{"column2", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv)}
})