let
Source = Folder.Files(“C:\Users\cookki\OneDrive - Hewlett Packard Enterprise\HPE\Excel\Excel\Power Query\Workouts Ch1”),
#“Filtered Hidden Files1” = Table.SelectRows(Source, each [Attributes]?[Hidden]? <> true),
#“Invoke Custom Function1” = Table.AddColumn(#“Filtered Hidden Files1”, “Transform File”, each #“Transform File”([Content])),
RenamedColumns1 = Table.RenameColumns(#“Invoke Custom Function1”, {“Name”, “Source.Name”}),
RemovedOtherColumns1 = Table.SelectColumns(RenamedColumns1, {“Source.Name”, “Transform File”}),
AddedCustom = Table.AddColumn(RemovedOtherColumns1, “Custom”, each Table.DemoteHeaders([Transform File])),
RemovedColumns = Table.RemoveColumns(AddedCustom,{“Source.Name”, “Transform File”}),
ExpandedCustom = Table.ExpandTableColumn(RemovedColumns, “Custom”, {“Column1”, “Column2”, “Column3”, “Column4”, “Column5”, “Column6”, “Column7”, “Column8”, “Column9”, “Column10”, “Column11”, “Column12”, “Column13”, “Column14”, “Column15”, “Column16”, “Column17”, “Column18”, “Column19”, “Column20”, “Column21”, “Column22”, “Column23”, “Column24”, “Column25”, “Column26”, “Column27”, “Column28”, “Column29”, “Column30”, “Column31”, “Column32”, “Column33”, “Column34”, “Column35”, “Column36”, “Column37”, “Column38”, “Column39”, “Column40”, “Column41”, “Column42”, “Column43”, “Column44”, “Column45”, “Column46”, “Column47”, “Column48”, “Column49”, “Column50”, “Column51”, “Column52”, “Column53”, “Column54”, “Column55”}, {“Column1”, “Column2”, “Column3”, “Column4”, “Column5”, “Column6”, “Column7”, “Column8”, “Column9”, “Column10”, “Column11”, “Column12”, “Column13”, “Column14”, “Column15”, “Column16”, “Column17”, “Column18”, “Column19”, “Column20”, “Column21”, “Column22”, “Column23”, “Column24”, “Column25”, “Column26”, “Column27”, “Column28”, “Column29”, “Column30”, “Column31”, “Column32”, “Column33”, “Column34”, “Column35”, “Column36”, “Column37”, “Column38”, “Column39”, “Column40”, “Column41”, “Column42”, “Column43”, “Column44”, “Column45”, “Column46”, “Column47”, “Column48”, “Column49”, “Column50”, “Column51”, “Column52”, “Column53”, “Column54”, “Column55”}),
PromotedHeaders = Table.PromoteHeaders(ExpandedCustom, [PromoteAllScalars=true]),
Remove2ndTblHeaders = Table.SelectRows(PromotedHeaders, each ([Location] <> “Branch”)),
ChType = Table.TransformColumnTypes(Remove2ndTblHeaders,{{“Location”, type text}, {“Customer”, type text}, {“Customer Nr.”, type text}, {“cw01”, Int64.Type}, {“cw02”, Int64.Type}, {“cw03”, Int64.Type}, {“cw04”, Int64.Type}, {“cw05”, Int64.Type}, {“cw06”, Int64.Type}, {“cw07”, Int64.Type}, {“cw08”, Int64.Type}, {“cw09”, Int64.Type}, {“cw10”, Int64.Type}, {“cw11”, Int64.Type}, {“cw12”, Int64.Type}, {“cw13”, Int64.Type}, {“cw14”, Int64.Type}, {“cw15”, Int64.Type}, {“cw16”, Int64.Type}, {“cw17”, Int64.Type}, {“cw18”, Int64.Type}, {“cw19”, Int64.Type}, {“cw20”, Int64.Type}, {“cw21”, Int64.Type}, {“cw22”, Int64.Type}, {“cw23”, Int64.Type}, {“cw24”, Int64.Type}, {“cw25”, Int64.Type}, {“cw26”, Int64.Type}, {“cw27”, Int64.Type}, {“cw28”, Int64.Type}, {“cw29”, Int64.Type}, {“cw30”, Int64.Type}, {“cw31”, Int64.Type}, {“cw32”, Int64.Type}, {“cw33”, Int64.Type}, {“cw34”, Int64.Type}, {“cw35”, Int64.Type}, {“cw36”, Int64.Type}, {“cw37”, Int64.Type}, {“cw38”, Int64.Type}, {“cw39”, Int64.Type}, {“cw40”, Int64.Type}, {“cw41”, Int64.Type}, {“cw42”, Int64.Type}, {“cw43”, Int64.Type}, {“cw44”, Int64.Type}, {“cw45”, Int64.Type}, {“cw46”, Int64.Type}, {“cw47”, Int64.Type}, {“cw48”, Int64.Type}, {“cw49”, Int64.Type}, {“cw50”, Int64.Type}, {“cw51”, Int64.Type}, {“cw52”, Int64.Type}})
in
ChType