Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I'm importing data from different sources, excel and csv, I'm looking for a way to add a column that specifies the name of the source file.
eg. DataSource 1 of type excel has the field animal name and the name of the file is Test 1.xlsx, DataSource 2 has the same format but of type csv.
Desired output.
Name SourceName
Cat Test1.xlsx
Dog Test1.xlsx
Cat Test.csv
I would like this to be updated on each import.
Any help on how to achieve this would be highly appreciated
Ah. that wasn't mentioned in your initial question.
Proud to be a Super User!
HI @Dee
If you use load the file(s) using Get Data -> From Folder, then filter for the file(s) you want, you'll end up with a column showing the filename, for example
let
Source = Folder.Files("d:\temp"),
#"Filtered Rows" = Table.SelectRows(Source, each ([Name] = "data.xlsx"))
in
#"Filtered Rows"
Gives me this
Regards
Phil
If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.
Proud to be a Super User!
I am getting data from a web source.
Web API specifically on powerapps power query.
This is possible. You start with your table of filenames and folderpaths, then you can concatenate those into into a custom column, either using a function or an if then else that use Excel.Workbook or CSV.Document depending on file type. It would be easier to have one query that gets all your CSVs (potentially two separate queries, one for each Folder), and another that gets all your Excel files (or two). You can then make sure the column names match and append them all together. You can then uncheck Enable Load on all but the final appended table.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
83 | |
70 | |
60 |
User | Count |
---|---|
150 | |
115 | |
104 | |
89 | |
65 |