0
votes

I have created a new name (variable) in excel using the Name Manager which is called fPath. The value for the name is =CELL("filename").

Name (variable)

I would like to reference this name as a parameter to the source within a function query. But, when I try to invoke the function within the Power Query Editor, I get an error that it wasn't able to find the name.

When the name refers to a cell within the sheet, this works perfectly but when a name is created without a reference to a cell, it is unable to find it.

Am I correct in assuming that what I'm trying to do is not possible?

EDIT:

Here's the code for for the Function Query where I have defined a parameter which is then used to dynamically get the source of the file.

[query details]

Error Image

2

2 Answers

1
votes

Try this:

= Excel.CurrentWorkbook(){[Name="fPath"]}[Content]

Or:

= Excel.Workbook(File.Contents("C:\YourFile.xlsx"), null, true){[Item="fPath",Kind="DefinedName"]}[Data]