Forum Discussion

Franck69's avatar
Franck69
Frequent Visitor
1 year ago

Local Files : How to identify the directory in which the report is

Hi everybody, I need to work on a report that uses only the files that are in the same directory than the report itself.

How can I find or identify in PowerQuery the directory in which the report itself is (the file .pbix).

I can't find anything about this in the forum. I would like to be able to save my report in any directory, open it and refresh to show which files are in this directory. Txs by advance !

3 Replies

  • Hello Franck69,

     

    Can you please try this approach in Power Query (Advanced Editor) of your new blank query:

    let
    Source = Text.FromBinary(Extension.Contents("dummy.txt")),
    ReportPath = Text.Start(Source, Text.PositionOf(Source, "dummy.txt") - 1)
    in
    ReportPath

    Hope this helps.

    • Franck69's avatar
      Franck69
      Frequent Visitor

      Hi Sahir, it seems that this tip doesn't work. Extension.Contents function doesn't exist with a commun connector.

       Anything else ? This use case must be quite common.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Franck69 ,

     

    You can find the directory in the advanced editor.

    For example, go to the advanced editor and check the code.

    Or click the zigzag button in the first step.

     

     

    Best Regards,

    Stephen Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.