Eugene
Eugene

Reputation: 1264

How to reference current workbook filename/path in PowerQuery?

Is there any sound way of getting full filename for the workbook where PowerQuery query resides inside from this query?

I tried to do this by inserting formula =CELL("filename") in a hidden worksheet, but this is not reliable. When I switch workbooks, this cell randomly changes value, and it doesn't [always] return it to original workbook filename after I switch back. Formula calculation is set to "Automatic".

That's why I 'm asking this question. Is there other method or workaround?

Upvotes: 3

Views: 1869

Answers (1)

LJ01
LJ01

Reputation: 589

Try using

=cell("filename",indirect("A1",TRUE))

Excel will evaluate the Cell() function based on last active cell if [Reference] is omitted.

Upvotes: 4

Related Questions