Is it possible to import parameterised .csvs from a folder? Query not possible with File.Contents!
first post here...I'm very much a noob so I apologise in advance if my query is overly basic. I've spent the last couple of days searching online for a solution but can't seem to find one.
The objective; import and append a dynamic set of .csv files (Identically formatted) from a folder without first having to load all files from the folder first.
To explain a little further...we receive a set of 7 files every day from a vendor via ftp into a folder which already contains all the historical files. The files are easily distinguishable as they contain a date. I wish to extract the new files and append them into a single file. Now, if I was certain that the number of files per day in future would always be 7 I could set up individual data queries and append later. However, that is not the case.
What I tried with regard to parameters etc. is below...I based this from a post from @ImkeF where she scraped information from a number of webpages. however, the solution doesn't work in this instance because query functionality is not available with File.Contents (BIAccountant's version used web.contents).
FolderPath = parameter for the folder containing the files. No problem.
ImportDataFiles = parameter containing the static part of the filenames, linked to the dynamic range
FileDate = the date portion of the filename. I separated this as it changes each day.. it simplified the ImportDataFiles parameter
So a complete filepath = FolderPath & ImportDataFiles & FileDate
I then tried to create a query to retrive the files;
If you can predict the full filenames, you could dynamically generate them in your query as a single-column table, and then make a custom column with File.Contents and concatenate the new filenames with the folder path. Can you give an example of a few full filenames? Are they predictable? Or have random characters?
Did I answer your question? Mark my post as a solution! Kudos are also appreciated!
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.