Forum Discussion
David_M_W
1 year agoFrequent Visitor
Automation from a folder.
Greeting from the north of Sweden. From a folder with 10 Excel files, each with 3 sheets, I have managed to extract, transform and combine the information I require for a table the feeds a weekly r...
- 1 year ago
Below is how you can fix.
The #"Expanded Table Columns1" step refers to your sample file.
You can replace that reference to a reference to the field created earlier representing your XLS file.
I commented my changes. You may have to adapt to your own situation....
let Source = Folder.Files("C:\ y"), #"Filtered Rows" = Table.SelectRows(Source, each Text.Contains([Name], "2024")), #"Filtered Hidden Files1" = Table.SelectRows(#"Filtered Rows", each [Attributes]?[Hidden]? <> true), #"Invoke Custom Function1" = Table.AddColumn(#"Filtered Hidden Files1", "Transform File", each #"Transform File"([Content])), #"Renamed Columns1" = Table.RenameColumns(#"Invoke Custom Function1", {"Name", "Source.Name"}), #"Removed Other Columns1" = Table.SelectColumns(#"Renamed Columns1", {"Source.Name", "Transform File"}), // --> This is causing the error: #"Expanded Table Column1" = Table.ExpandTableColumn(#"Removed Other Columns1", "Transform File", Table.ColumnNames(#"Transform File"(#"Sample File"))), // Replace with #"Expanded Table Column1" = Table.ExpandTableColumn(#"Removed Other Columns1", "Transform File", Table.ColumnNames(#"Removed Other Columns1"{0}[Transform File])), #"Changed Type" = Table.TransformColumnTypes(#"Expanded Table Column1",{{"Source.Name", type text}, {"Name", type text}, {"Data", type any}, {"Item", type text}, {"Kind", type text}, {"Hidden", type logical}}) in #"Changed Type"
PwerQueryKees
1 year agoSuper User
I think I know what your problem is. You have created your queries through the UI and you now have some helper queries that are giving you trouble.
Something like this!
David_M_W
1 year agoFrequent Visitor
Exactly like this! I seemed to have made a working solution by leaving the helper file in the folder. So I delete 9 of the 10 files when adding the next bundle of files. Then as many suggested I filter out that file I a final step. It seems to be working but I love to learn the M Code way!