Forum Discussion

Mrquestionmark's avatar
4 years ago
Solved

M query using folder.contents questions

I have almost 20K files in the folder and I only need to load some of files based on naming. In my M query, I am using folder.contents first and then filter out the files after.   But the challenge...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Spread out the files into different folders

  • Anonymous's avatar
    Anonymous
    4 years ago

    let
        Source = Table.FromColumns({Lines.FromBinary(File.Contents("D:\folder\index.txt"), null, null, 936)}),
        #"Filtered Rows" = Table.SelectRows(Source, each Text.StartsWith([Column1], "wanted")),
        #"Added Custom" = Table.AddColumn(#"Filtered Rows", "path", each "D:\folder\" & [Column1]),
        #"Added Custom1" = Table.AddColumn(#"Added Custom", "Content", each File.Contents([path]))
    in
        #"Added Custom1"