Forum Discussion

umtkyn's avatar
umtkyn
Regular Visitor
2 years ago
Solved

list all tables' names dynamically

hi,

 

Is there a way to create a list of all tables' names dynamically in an excel file with powerquery ?

 

Thanks,

  • umtkyn You can use the path of the current file and then filter for Tables.

     

    let
        Source = Excel.Workbook ( File.Contents ( "C:\Users\antsharma\Downloads\1.xlsx" ) ),
        TableNames = Table.SelectRows ( Source, each [Kind] = "Table" )[[Name]]
    in
        TableNames

     

3 Replies

  • AntrikshSharma's avatar
    AntrikshSharma
    Community Champion

    umtkyn You can use the path of the current file and then filter for Tables.

     

    let
        Source = Excel.Workbook ( File.Contents ( "C:\Users\antsharma\Downloads\1.xlsx" ) ),
        TableNames = Table.SelectRows ( Source, each [Kind] = "Table" )[[Name]]
    in
        TableNames

     

    • umtkyn's avatar
      umtkyn
      Regular Visitor

      how do you manage if you need to do it in the same file ?  

  • umtkyn's avatar
    umtkyn
    Regular Visitor

    thank you, i was actually trying to append all the tables in it and i found a solution... for future reference i write it also here...

     

     

    Source = Excel.Workbook(File.Contents("C:\Users\777\filename.xlsx"), null, true),
    #"Filtered Rows" = Table.SelectRows(Source, each ([Kind] = "Table")),
    CombineTable= Table.Combine(#"Filtered Rows"[Data])