Forum Discussion

ivanuska's avatar
ivanuska
Advocate I
1 year ago
Solved

Power Query - Dynamic selection of document name

Hello,   I would need your help with dynamic selection of excel file on OneDrive. We have script that is creating excel file (.xlsm) and saving it into OneDrive in format "Document Name - DD/MM/YYY...
  • OwenAuger's avatar
    1 year ago

    Hi ivanuska 

    The easiest way to fix this is to edit the code in the formula bar of your 2nd screenshot by replacing the code between the curly braces with "0"

    In other words, change the code for this step to:

     

    = #"Filtered Rows1"{0}[Content]

     

    The zero corresponds to the first row of the table from the previous step named "Filtered Rows1" (using a zero-based index). Since you have already filtered the table to a single row, the first row will always correspond to the file you want to use.

     

    Here is a short recording of me starting with a query similar to yours and editing the M code for that step:

     

    Does this work for you?