Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Copilot Studio - General
Answered

Copilot and PowerAutomate Excel get a row function

(0) ShareShare
ReportReport
Posted on by

I've been able to let Copilot use a Power Automate flow where
1- Copilot passes to PA a string parameter (a product code)

2- the flow search for the parameter value in a column of a given excel file ("get a row" action)

3- when flow matches parameter and xlsx data, returns to Copilot a numeric value contained in another column (the product price).

4- Copilot shows a message like "price of product is xxx"


It works fine while parameter contains something present in xlsx file.

When parameter is not present in xlsx, the flow returns an error (I think it's because it try to return to copilot a blank value into the numeric output but I'm not sure), Copilot exits from current argument and switches to "On error" argument.

 

I'd like to avoid the switch -Copilot side- and show a message like "code not found"... any suggestion is welcome 

 

Categories:
  • Pstork1 Profile Picture
    66,442 Most Valuable Professional on at
    Re: Copilot and PowerAutomate Excel get a row function

    The run after setting will still handle the condition where the row isn't found.  The way you do the regular condition depends on how you want to handle it if some of the columns contain data and some don't. But its still the same flow.

  • theMac Profile Picture
    on at
    Re: Copilot and PowerAutomate Excel get a row function

    My bad, I mean if I need data from multiple columns of a single row of Excel file

  • Pstork1 Profile Picture
    66,442 Most Valuable Professional on at
    Re: Copilot and PowerAutomate Excel get a row function

    If you need multiple rows you would use the Get Rows action that returns an array.  Then check the length of that array to see if its empty. The run after check for an error won't be necessary because get rows works even if it doesn't find a match.  But the values still need to be returned as a formatted string since you can't return an array to the bot.

  • theMac Profile Picture
    on at
    Re: Copilot and PowerAutomate Excel get a row function

    Thank you, it seems it works!
    What if I need an entire rows of data from the excel file instead of a single value?
    Do have I to use an array variable to store data from excel when Get a row is successful?

  • Verified answer
    Pstork1 Profile Picture
    66,442 Most Valuable Professional on at
    Re: Copilot and PowerAutomate Excel get a row function

    To handle that case you need to add a parallel branch with a set variable action that is set to run if the Get Row action fails.  Make sure to then have the respond action run from both parallel paths and set it to run if the main branch is skipped.  That way if the row is not found it will set the message in the variable and return it even though the Get a row threw an error. That's standard error handling for Power Automate.

    image.png

  • theMac Profile Picture
    on at
    Re: Copilot and PowerAutomate Excel get a row function

    I agree that it should be pretty easy but I'm still here...


    "If you add a condition to check the result of the get a row action
    You can't check the result of Get a row action in any way, that's the problem.
    So far I didn't found a way to intercept the failure of the action when no rows are found.

    I read somewhere else that I don't have to use Get a Row action but Get a list of rows filtered by input parameter and iterate on the rows but it seems to me an "expensive" way to obtain a result

  • Pstork1 Profile Picture
    66,442 Most Valuable Professional on at
    Re: Copilot and PowerAutomate Excel get a row function

    This is pretty easy to do depending on how you are returning things to Copilot. The most common way is to create a string variable and build out the response in the variable as data is found in the row.  If you add a condition to check the result of the get a row action you can have it set that variable if the row was found or set the return variable to the "Code not found" string if it isn't.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Copilot Studio - General

#1
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 74

#2
Pablo Roldan Profile Picture

Pablo Roldan 61

#3
stampcoin Profile Picture

stampcoin 10

Overall leaderboard