SOLVED

Power Query File Name Drop Down

Copper Contributor

I'm going to do my best to describe this.  I would like to create a parameter query where the user selects a filename and the table will display based on what the user selects from the drop down.  I know that I will probably need to concatenate the parameters I created.  Let me give you an example.  On the Song worksheet, in the Anyone.xlsx file, the Anyone Table is displayed.  If the user selected Elderly.xlsx from my file_name drop down table I want the Elderly.xlsx table to display on the worksheet.  If you have any suggestions or can point me to a blog post that would help me answer this question.  I would greatly appreciate the help. 

1 Reply
best response confirmed by lmk001 (Copper Contributor)
Solution

@lmk001 

If file and table names are the same you may add named cell, let say fileTableName, in your workbook with it's name, after that it's like

let
    getFileTableName = Excel.CurrentWorkbook(){[Name="fileTableName"]}[Content]{0}[Column1],
    Source = Excel.Workbook(File.Contents("C:\Test\" & getFileTableName & ".xlsx"), null, true),
    Table1_Table = Source{[Item=getFileTableName,Kind="Table"]}[Data]
in
    Table1_Table

just change the folder name as necessary. With drop-down list it's the same, named cell will be one with drop-down list.

1 best response

Accepted Solutions
best response confirmed by lmk001 (Copper Contributor)
Solution

@lmk001 

If file and table names are the same you may add named cell, let say fileTableName, in your workbook with it's name, after that it's like

let
    getFileTableName = Excel.CurrentWorkbook(){[Name="fileTableName"]}[Content]{0}[Column1],
    Source = Excel.Workbook(File.Contents("C:\Test\" & getFileTableName & ".xlsx"), null, true),
    Table1_Table = Source{[Item=getFileTableName,Kind="Table"]}[Data]
in
    Table1_Table

just change the folder name as necessary. With drop-down list it's the same, named cell will be one with drop-down list.

View solution in original post