0
votes

Very simple, below is the source file code to pull CSV files from a folder. I want to pull files of whichever date that contain a specific text string.

For instance the file path is : C:\Users\Sebs\Desktop\Professional Clients\Tradmarket\Data\EquitiesExecuted_05-03-2019_to_05-03-2020.txt

I want to change this so it pulls only the files that have the word "EquitiesExecuted" regardless of the rest of the text string.

Source = Csv.Document(File.Contents("C:\Users\Sebs\Desktop\Professional Clients\Kau Markets\Data\CFDTradesExecuted_05-03-2019_to_05-03-2020.txt"),[Delimiter=",", Columns=60, Encoding=1252, QuoteStyle=QuoteStyle.None]),

Many thanks!

1

1 Answers

1
votes
  • Use Folder.Files to download a table with all the files
  • Then Filter (Table.SelectRows according to your criteria
  • The Content column will contain a link to each file, and you can decide what you want to do with the result. You have a number of options.
    Source = Folder.Files("C:\Users\Sebs\Desktop\Professional Clients\Tradmarket\Data"),
    #"Filtered Rows" = Table.SelectRows(Source, each Text.Contains([Name], "EquitiesExecuted"))

The Content column will contain a link to each file, and you can explore the various options available to you.