cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PedroRibeiro
Frequent Visitor

Sharepoint filter by file type/extension

Hi,

I'm trying to create a flow to get only some files.

How can I filter by docx, doc, xls, xlsx, ppt, pptx?

Thanks.

3 ACCEPTED SOLUTIONS

Accepted Solutions
v-bacao-msft
Community Support
Community Support

Hi @PedroRibeiro,

 

You could get all files information first by using Get files(properties only).

Then use Filter array to filter files, if the file name with the extension ends with the expected file format.

Use endswith() function to make a decision.

Formula reference:

 

@or(endswith(item()?['{FilenameWithExtension}'], '.docx'),endswith(item()?['{FilenameWithExtension}'], '.doc'),endswith(item()?['{FilenameWithExtension}'], '.xls'),endswith(item()?['{FilenameWithExtension}'], '.xlsx'),endswith(item()?['{FilenameWithExtension}'], '.ppt'),endswith(item()?['{FilenameWithExtension}'], '.pptx'))

Image reference:

30.PNG

Please take a try.

 

Best Regards,

Barry

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi!

 

There is a better and more effecient way to do this. Filtering result array is time consuming for thouthands of documents.

 

Just use this oData filter under Advanced section of the "Get files" action:

File_x0020_Type eq 'xls'

 

You can find example of usage in this article.

 

This approach is better because it returns only required files.

 

View solution in original post

This should work for you:

File_x0020_Type eq 'xls' or File_x0020_Type eq 'doc' or File_x0020_Type eq 'ppt'

 

I didn't test it.

View solution in original post

6 REPLIES 6
v-bacao-msft
Community Support
Community Support

Hi @PedroRibeiro,

 

You could get all files information first by using Get files(properties only).

Then use Filter array to filter files, if the file name with the extension ends with the expected file format.

Use endswith() function to make a decision.

Formula reference:

 

@or(endswith(item()?['{FilenameWithExtension}'], '.docx'),endswith(item()?['{FilenameWithExtension}'], '.doc'),endswith(item()?['{FilenameWithExtension}'], '.xls'),endswith(item()?['{FilenameWithExtension}'], '.xlsx'),endswith(item()?['{FilenameWithExtension}'], '.ppt'),endswith(item()?['{FilenameWithExtension}'], '.pptx'))

Image reference:

30.PNG

Please take a try.

 

Best Regards,

Barry

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Barry,

It works.

Thank you.

Hi!

 

There is a better and more effecient way to do this. Filtering result array is time consuming for thouthands of documents.

 

Just use this oData filter under Advanced section of the "Get files" action:

File_x0020_Type eq 'xls'

 

You can find example of usage in this article.

 

This approach is better because it returns only required files.

 

View solution in original post

@anton-khrit 

Yes I noticed that takes too long because we have multiple files.

With your solution, how can I search for xls, doc, ppt in the same filter? It's possible?

This should work for you:

File_x0020_Type eq 'xls' or File_x0020_Type eq 'doc' or File_x0020_Type eq 'ppt'

 

I didn't test it.

View solution in original post

@anton-khrit-hq 

Your solution works perfectly, and is faster.

Thank you.

 

How can I run this in a specific folder inside "Shared Documents"?

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Users online (43,690)