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.
Solved! Go to Solution.
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:
Please take a try.
Best Regards,
Barry
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.
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.
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:
Please take a try.
Best Regards,
Barry
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.
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.
Your solution works perfectly, and is faster.
Thank you.
How can I run this in a specific folder inside "Shared Documents"?
User | Count |
---|---|
18 | |
15 | |
14 | |
8 | |
4 |
User | Count |
---|---|
10 | |
6 | |
4 | |
4 | |
3 |