Forum Discussion

Arkhos94's avatar
Arkhos94
Helper IV
5 years ago
Solved

Sharepoint folder source / How to filter well ?

After a lot of try I manage to connect my power query to my sharepoint folder. The data I want to load is a set of excel file (one per month, named "nationales + year-month" (so "Nationale 2021-05", "Nationale 2021-04" and so on)

 

I load more file that I want, so I need to filter. But I want the filter to be efficient so I don't want to update my filter each month

 

Right now my power query look like this :

Source = SharePoint.Files("https://mycompany.sharepoint.com/sites/sharepointsitename", [ApiVersion = 15]),
#"Lignes filtrées" = Table.SelectRows(Source, each ([Name] = "Nationale 2021-01.xlsx" or [Name] = "Nationale 2021-02.xlsx" or [Name] = "Nationale 2021-03.xlsx" or [Name] = "Nationale 2021-04.xlsx" or [Name] = "Nationale 2021-05.xlsx")),

 

Is there any way to replace the "each ([Name] =" so it will select every name that start by "Nationale " ?

  • = Table.SelectRows(Source, each Text.StartsWith([Name], "Nationale"))

3 Replies

  • CNENFRNL's avatar
    CNENFRNL
    Community Champion
    = Table.SelectRows(Source, each Text.StartsWith([Name], "Nationale"))
  • Thank you CNENFRNL 

     

    I think it's time for me to start learning the coding language used by power query

    • CNENFRNL's avatar
      CNENFRNL
      Community Champion

      Yes, indeed, perhaps 20% of ETL tasks can be completed by UI; the real power of Power Query lies in the M language.

      Good luck!