November 17, 2024

The “For a selected row” trigger is incredibly useful., especially for those who use Excel to store data. It takes advantage of Power Automate’s “add-in” in Excel to perform actions on datasets. We can do a lot with it, but for now, let’s look at how to use the “For a selected row” trigger efficiently.

Where to find it?

To find it, you can search for the “For a selected row” trigger or go to” Standard” and find “Excel Online for Business.”

You can find the Excel Online for Business in the Standard tab. You may need to expand the options to find it.

Select the “for a selected row” trigger:

Pick in the list of triggers the "for a selected row"

Here is what is looks like:

The "for a selected row" trigger  requires a location, document library a file and a table to work
Pro Tip:
Power Automate tends to save the most common triggers on the main screen, so check there before going through the full hierarchy. Also, you can use the search to find it quickly.

Usage

For this example, we’ll use OneDrive for Business, but you can use SharePoint Document Libraries or any other place to save an Excel file in Office 365.

The "for a selected row" filled in with test values.
You will need to have the Flow’s “add-in” installed in Excel. If you don’t know how to do it, please refer to the “How to install Power Automate’s add-in in Excel”.

Excel’s structure is super simple.

A simple Excel table with a key, date and title

We want to prove the concept, so there’s no need to worry about things. The Flow is also super simple:

The Flow that we'll use to demonstrate how the "for a selected row" trigger works. It will include the trigger and a compose with the key.

No need to complicate things.

Outputs

Let’s look of what we get from the trigger:

List of the two types of variables that the trigger returns. The first details from the person who triggered it and the second the information from Excel.

We have two groups of data. The first will contain the information of the user that triggered the Flow. The data is essential for things like:

  1. Custom behavior depends on the person, department, etc.
  2. Keep a log or an audit of the information that was provided.
  3. Send a notification to the user when the Flow finishes.

These are only some examples, but you can do a lot more. The information is there so that you can use it.

The second group is the Excel columns, the information you’re looking for to parse. Again, all columns will be returned for the selected row.

Testing

If you try to test the Flow, Power Automate will block it.

It's not possible to trigger a Flow manually with the "for a select row in Excel". The trigger will always come from Excel.

It’s not usual for this to happen, but there’s a good reason for the “for a selected row” trigger. Since we need it to be triggered from Excel, we can’t do it manually from Flow online. Instead, the row needs to be selected in Excel, so all you can do is build the Flow and trigger it in Excel as follows. First, press the Flow’s add-in button on the Data tab, select the data, and press run.

To trigger the Flow, select the row of the data and press "run" in the list of available Flows in the "Flow for Excel" add-in

LEt’s go back to our online Flow and see what happened.

The result of the trigger. We received the details from the row that we selected in Excel.

Looks good. We got the Flow to trigger, and the information was provided correctly. Now you can

Limitations

You can only use this for Power Automate. Microsoft is working on other targets, but we can only use Power Automate to parse this information.

Another limitation is that you can’t use solutions in all the tests I performed. When you open Flow’s Excel “add-in,” you’ll only see the ones in your “My Flows.” I’m probably missing something, but I’ll update the article as soon as I find how to use solutions.

Recommendations

Here are some things to keep in mind.

Make the Flow as fast as possible.

This recommendation is a give for all Flows, but it’s essential for this one since multiple people may access the Excel file simultaneously and trigger it with the same data. So if you’re parsing or changing the data in any way, you need to propagate those changes as fast as possible.

Don’t change the source file.

I also recommend that you don’t change or update data in the Excel that Flow uses for the same reason. Multiple people can access the Excel file, and by changing the data, you’ll have the situation where person A triggers the Flow and person B still sees the “old” data. Again, keeping the source file as a “read-only” from Power Automate’s point of view helps avoid data conflicts.

Name it correctly

The name is super important since we can get the trigger from anywhere and with anything. Always build the word so others can understand what you are using without opening the action and checking the details.

Always add a comment.

Adding a comment will also help avoid mistakes. Indicate your expectations, why the Flow should be triggered, and the data used. It’s essential to enable faster debugging when something goes wrong.

In the case of the “for a selected row” trigger, it’s even more important to keep things documented because you may not understand the type of data or why the user “A” is triggering the Flow.

Back to the Power Automate Trigger Reference.

Photo by Mitchel Lensink on Unsplash

Manuel Gomes

I have 18 years of experience in automation, project management, and development. In addition to that, I have been writing for this website for over 3 years now, providing readers with valuable insights and information. I hope my expertise allows me to create compelling, informative content that resonates with the audience.

View all posts by Manuel Gomes →

One thought on “Power Automate: Office 365 Excel – For a selected row Trigger

  1. Hi. I hava a question.
    I created a flow using “for a selected row” trigger.
    Often it work correctly.
    However, when I selected Not-continuous rows, body of trriger is empty and error occured.
    Do you know how can I Fix it?

Leave a Reply

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

Mastodon