电源查询列表到表

时间:2015-12-04 10:51:06

标签: list split transform powerquery

我无法将列表转换为表格。

所以这个:

{{"123","1.1","321"},{"12","345","345"}}

应转换为此

F=bing*

如果你可以轻松转换到这个

的功能,那就更好了
*

1 个答案:

答案 0 :(得分:3)

可能不是最好的方式:

let
    ListToTable = (sourceList as list, columnCount as number) as table =>
    let
        #"Converted to Table" = Table.FromList(sourceList , Splitter.SplitByNothing(), null, null, ExtraValues.Error),
        #"Added Index" = Table.AddIndexColumn(#"Converted to Table", "Index", 0, 1),
        #"Integer-Divided Column" = Table.TransformColumns(#"Added Index", {{"Index", each Number.IntegerDivide(_, columnCount), Int64.Type}}),
        #"Grouped Rows" = Table.FromRecords(List.Transform(Table.Group(#"Integer-Divided Column", {"Index"}, {{"Rows", each Table.SelectColumns(_, "Column1"), type table}})[Rows], (rowTable) => Table.First(Table.Transpose(rowTable))))
    in
        #"Grouped Rows"
in
    ListToTable({1,2,3,4,5,6}, 3)