Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

How to reference list of lists in Table.RenameColumns function?

Table.RenameColumns takes two values -- the table you want to modify, and a list (or list of lists) containing the old and new column names.  Example given in Power Query documentation: Replace the...
  • ImkeF's avatar
    2 years ago

    Hi Anonymous ,
    just omit the merge step and you should be good to go:

    let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WilHyz0nxS8xNNYxRUtIBcv1Sy2HcWB0keSNUeSN0eWNUeRA3NhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [OldNames = _t, NewNames = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"OldNames", type text}, {"NewNames", type text}}),
    #"create list of lists" = Table.ToRows(#"Changed Type")
    in
    #"create list of lists"


    By merging the columns, you are creating one string that will then become a list with just one element.
    But you need a list with 2 elements in it. So omitting the merge will just solve the issue.