Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Outlook
    • Planner
    • Power Apps
    • SharePoint
    • Teams
  • Triggers
  • Ready to use solutions
    • Approval Process Template
    • Task Delegation App
    • The Ultimate Power Automate expressions cheat sheet
    • Power Automate HTTP requests to SharePoint cheat sheet
    • Power Automate HTTP requests to Graph API cheat sheet
  • ABOUT ME
  • Get help with your flow
  • POWER PLATFORM SERVICES
Menu

Trigger Power Automate flow only on specific file in a library

Posted on March 30, 2022March 30, 2022 by Tom

“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.

Power Automate trigger specific file

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:

@equals(triggerOutputs()?['body/{FilenameWithExtension}'], 'TriggerFile.txt')

It’s possible to run it for files that contain a specific string in the file name:

@contains(triggerOutputs()?['body/{FilenameWithExtension}'], 'TriggerFile')

It can trigger for a specific file type:

@endswith(triggerOutputs()?['body/{FilenameWithExtension}'], '.pdf')

Or run on files in a specific folder:

@contains(triggerOutputs()?['body/{Path}'], '/Review/')

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.

Power Automate trigger specific file

Summary

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.


πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

5 thoughts on “Trigger Power Automate flow only on specific file in a library”

  1. Thomas says:
    June 10, 2022 at 8:27 pm

    Hi Tom! Great post, this low-code approach is immensely helpful! Would it be possible to use low-code in order to enable the flow to identify specific destination folders based on date?
    i.e. A file that has the date March_2022 in its title to be copied in the relevant destination folder, March 2022 and so on, without having to create multiple flows for each year/month.

    Reply
    1. Tom says:
      June 19, 2022 at 9:38 am

      Hello Thomas,
      you can do that, just split the file name (https://tomriha.com/how-to-split-file-name-for-further-processing-in-power-automate/) and then use the parts of the name to build the destination folder.

      Reply
  2. mechille says:
    September 13, 2022 at 8:13 am

    hi Tom,

    I’m keeping my monthly file in a Sharepoint folder. Every month, I’m adding a File with a file name format of ReviewBSR . Now I want to do conditional trigger that will only trigger the flow whenever I’m creating new files in this folder with a file name that starts with ReviewBSR

    Reply
    1. Tom says:
      September 18, 2022 at 7:13 pm

      Hello Mechille,
      you can combine the action settings (it has a possibility to select which folder it should check) with a trigger condition @startsWith(…) (instead @endsWith from the article).

      Reply
  3. Pat Moss says:
    December 18, 2023 at 2:26 pm

    Thank you. Is it possible to do this with an attachment name vs file name?

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

Still exchanging emails to get things approved?

Use the Approval Process Template and the Task Delegation App to skip the hard part and deploy an automated, fully functional approval solution on a SharePoint list in minutes! And then the next one, and the next one...

Approval Template Preview ✨ Learn more ✨

Turn ideas into flows with ease!

Grab the complete Power Automate Cheat Sheet Bundleβ€”everything you need to master expressions, SharePoint HTTP calls, and Graph API in Power Automate.

Cheat Sheet Bundle Preview ✨ Get the Cheat Sheets

Didn't find what you were looking for?
Need to adjust a solution to fit your needs?
Or would you just like to get an assistance from somebody with thousands of hours of experience with Power Automate?

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2025 Let's POWER Automate | Theme by SuperbThemes