Andy L.

Andy L. ITM, VUB

Temat: How to split cells that have Line Feed into their own row


Obrazek



// Table1
let
Source1 = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
RC1 = Table.RemoveColumns(Source1,{"Header9"}),
Split1 = Table.ExpandListColumn(Table.TransformColumns(RC1, {{"Header8", Splitter.SplitTextByDelimiter("#(lf)", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Header8"),
Index1 = Table.AddIndexColumn(Split1, "Index", 1, 1),
Source2 = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
RC2 = Table.RemoveColumns(Source2,{"Header8"}),
Split2 = Table.ExpandListColumn(Table.TransformColumns(RC2, {{"Header9", Splitter.SplitTextByDelimiter("#(lf)", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Header9"),
Index2 = Table.AddIndexColumn(Split2, "Index", 1, 1),
Source = Table.NestedJoin(Index1,{"Index"},Index2,{"Index"},"Index3",JoinKind.LeftOuter),
Expand = Table.ExpandTableColumn(Source, "Index3", {"Header9"}, {"Header9"}),
Reorder = Table.ReorderColumns(Expand,{"Header1", "Header2", "Header3", "Header4", "Header5", "Header6", "Header7", "Header8", "Header9", "Header10", "Header11", "Header12", "Header13", "Header14", "Index"}),
RC = Table.RemoveColumns(Reorder,{"Index"})
in
RC