Forum Discussion
Import multiple files from multiple folders, and "refresh" load new file
- 4 years ago
Hi dnguyen67
If the files are on the local drive, you can use Folder connector to connect to the Parent folder. If the files are from an online OneDrive folder or an online SharePoint folder, you can use SharePoint Folder connector to connect to the site.
After you connecting to it successfully, you will see all files under that path in the preview window like below. Click on "Transform Data" button instead of "Combine Data" button. We need to filter the files in Power Query Editor before combining.
There is a Folder Path column there. You can click the dropdown icon to expand the menu and only select the subfolder paths that you want to import data from. This step will filter the files listed in the table and only remain files that are needed. Next time when you refresh data, it will only import data from these selected subfolders.
After that, click the combine icon on Content column header to combine data in remained files.
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
I have this solution
let
Source = Folder.Files("Your Folder"),
#"Filtered Rows" = Table.SelectRows(Source, let latest = List.Max(Source[Date created]) in each [Date created] = latest),
#"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows",{"Name", "Content"}),
#"Filtered Hidden Files1" = Table.SelectRows(#"Removed Other Columns", each [Attributes]?[Hidden]? <> true),
#"Invoke Custom Function1" = Table.AddColumn(#"Filtered Hidden Files1", "Transformar archivo", each #"Transformar archivo"([Content])),
#"Removed Other Columns1" = Table.SelectColumns(#"Invoke Custom Function1", {"Transformar archivo"}),
#"Expanded Table Column1" = Table.ExpandTableColumn(#"Removed Other Columns1", "Transformar archivo", Table.ColumnNames(#"Transformar archivo"(#"Archivo de ejemplo")))
in
#"Expanded Table Column1"