How to Add a Power Automate Button to a SharePoint Gallery View
Question details
The user needs to successfully trigger a Power Automate flow using a button inside a SharePoint document library gallery view without accidentally opening the document instead.

- Product
- SharePoint
- Device & OS
- not provided
- Scenario
- Adding a JSON-formatted button to a SharePoint document library gallery view to trigger a specific Power Automate flow.
- Observed behavior
- The JSON button appears on top of the gallery card, but clicking it opens the document instead of running the flow due to action conflicts within the gallery view format.
Ensure you have the necessary permissions to create and embed Power Apps in your SharePoint environment, and verify that your target Power Automate flow is turned on.
Recreate the Gallery Interface using Power Apps
By embedding a custom Power App in SharePoint, you can separate the button's flow trigger from the document's open action, bypassing the JSON formatting limitations of the native gallery view.
A JSON button that works perfectly in a standard SharePoint list view often fails in a document library gallery view because the entire gallery card acts as a clickable element. To achieve reliable button behavior, recreating the interface in Power Apps is the most effective workaround.
Open Power Apps, create a new Canvas app, and connect it to your SharePoint document library to recreate the gallery view interface.
Insert a Button control (e.g., a 'Feedback' button) into your Power Apps gallery to serve as the trigger for your Power Automate flow.
Select the newly added button, navigate to the Action tab, click Power Automate, and add your specific flow to the app.
Set the OnSelect property of the button to call the flow using the appropriate syntax, such as `SendanEmail.Run()`.
Insert a separate icon or text link in the gallery specifically configured to launch or open the document, ensuring it does not overlap with the flow button.
Save and publish your Power App. Navigate to your SharePoint page, add the Power Apps web part, and select your published app to display the functional gallery.

Looking for a seamless and lightweight Office alternative?
While advanced workflows like SharePoint and Power Automate belong to the Microsoft ecosystem, WPS Office provides a powerful, free, and lightweight alternative for your daily document creation, spreadsheet management, and presentation needs.
- 1. Download the software: Visit the official WPS website and download the free installation package for your operating system.
- 2. Install WPS Office: Run the downloaded setup file and follow the on-screen prompts to complete the installation.
- 3. Open and edit your files: Launch WPS Office and easily open your existing Microsoft Office documents to start editing immediately.

Frequently Asked Questions
Why does my JSON button open the document instead of running the flow in a gallery view?
In a SharePoint document library gallery view, the entire card defaults to opening the document when clicked. When a JSON button is overlaid on this card, it creates a click conflict, causing SharePoint to prioritize opening the document over running the associated flow.
Can I use standard JSON formatting for Power Automate buttons in standard list views?
Yes, standard JSON formatting for flow-trigger buttons works reliably in standard SharePoint list views. The layout of standard lists separates the item link from the button columns, avoiding the overlap conflicts seen in gallery views.
How do I link an existing Power Automate flow to a button in Power Apps?
In Power Apps, select the button you want to use, go to the 'Action' tab on the top ribbon, select 'Power Automate', and choose your existing flow from the list. Once added, set the button's OnSelect property to execute the flow (e.g., `YourFlowName.Run()`).




