Forum

Notifications
Clear all

PQ Dynamic Source

4 Posts
2 Users
0 Reactions
63 Views
(@algemron)
Posts: 6
Active Member
Topic starter
 

i am trying to set up a dynamic source iin power query so i can load the filepath and have it go there.

 

i've been able to do it by placing the filepath into a workbook and then pulling into PQ as a table, and using the drill down.

Renaming the query as Directory (table is called directory as well)

then going into the Advanced editor of the imported data query changing the "c:filepath name" with the directory (see below)

but when i've tried to do the same steps i cant recreate it

is there something i'm missing?

 

let
Source = Csv.Document(File.Contents(Directory),[Delimiter=",", Columns=2, Encoding=1252, QuoteStyle=QuoteStyle.None])
in
Source

 
Posted : 19/07/2018 5:39 am
(@algemron)
Posts: 6
Active Member
Topic starter
 

i get the message:

 

Formula.Firewall: Query 'TestFile' (step 'Source') references other queries or steps, so it may not directly access a data source. Please rebuild this data combination.

i've set the permissions to global

 
Posted : 19/07/2018 5:44 am
(@catalinb)
Posts: 1937
Member Admin
 

Hi Algemron,

File.Contents needs a file path, not a folder path.

Try starting the query using From Folder option, not from File, then change the folder path with a parameter.

 
Posted : 19/07/2018 11:30 pm
(@algemron)
Posts: 6
Active Member
Topic starter
 

thank you for this

think i've cracked it now with this

 
Posted : 20/07/2018 3:04 am
Share: