Forum Discussion
How to import files from different paths
You could create a separate query for each file, or simply create multiple "Source" lines. Either way, just append all of them together in the end. Not sure I can be more specific. ImkeF might have some thoughts as well.
let
Source = Csv.Document(File.Contents("C:\temp\powerbi\jobid.csv"),[Delimiter=",", Columns=2, Encoding=1252, QuoteStyle=QuoteStyle.None]),
Source1 = Csv.Document(File.Contents("C:\temp\powerbi\months.csv"),[Delimiter=",", Columns=2, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"JobID", Int64.Type}, {"Date", type date}}),
#"Appended Query" = Table.Combine({Source, Source1})
in
#"Appended Query"- ImkeF7 years agoCommunity Champion
You can start from a table with one pathname in each row. Then you have to convert your From-Path-query into a function and apply it in a custom column. Just expand the columsn afterwards.
- skurek7 years agoNew Member
file list is dynamical and i dont know how many files is in the table and i dont know files names...
so i cant write separate query for each file...
- ImkeF7 years agoCommunity Champion
I don't understand your request:
If you import from a folder, all files in that folder and all files in all its subfolders will be imported. UNLESS: You filter some files in them. So you just have to grab the uppermost path to grab all files in it.
If you have any other kind of logic to identify what shall be imported, please try to explain better.
- skurek7 years agoNew Member
I have files in many shared locations:
1. server in Poland, many folders and files
2. server in US, many folders and files...
3. ...
I can import all folders and files from these shared locations. BUT this cost PQ a lot of time.
Files and folders in these locations is too many.
before these files are displayed in PQ and I will filter them in pq - it takes a long, long time...
so i need to import only concrete files from shared locations...