“I’d like to trigger my Power Automate flow only when a specific file(s) are modified, not for all the files in the library!”
When you build a flow in Power Automate, it’s connected to the whole library. It doesn’t care what file users add or modify, it’ll process all the files in the same way. But sometimes you don’t want to process every file. There could be a change notification only for a single file in the library. Approval process that’s started only for a specific file type. Or a flow based on the file location in a folder structure. In all these situations it’s necessary to somehow recognise the file and process it or not.
Don’t use a ‘Condition’
While the first idea can be to use a ‘Condition’ in the flow, it’s not the right approach. To evaluate a condition the flow would have to trigger. Each trigger will cost you API calls and create an entry in the flow run history, leading to bit of a mess. That’s why you should go one step back, to the trigger.
Use a ‘Trigger Condition’ instead
If you go in the trigger settings, you’ll see a section called ‘Trigger Conditions’.
The trigger conditions setting allows you to add a condition directly in the trigger.
The flow doesn’t have to trigger to evaluate this condition, it’ll check it before that happens. If the condition returns ‘true’, the flow will run. If it returns ‘false’ the flow won’t start.
Therefore, if your goal is to run a flow only for a specific file, you should use a trigger condition. You can run the flow only for a file with an exact name:
It’s possible to run it for files that contain a specific string in the file name:
It can trigger for a specific file type:
Or run on files in a specific folder:
Don’t worry if you don’t know how to create such condition, you can use a workaround with the ‘Filter array’ action to create the right one for your needs.
Enter the condition as the ‘Trigger Condition’ in the trigger action and let your flow run only when it’s needed.
If you want to trigger your Power Automate flow only on a specific file, you should identify the file right away. That means in the trigger. Instead of running the flow for all the files and deciding in the flow what to do, you can use a trigger condition and run the flow only when necessary.