web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / Copilot and PowerAutom...
Copilot Studio
Unanswered

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:
I have the same question (0)
  • Pstork1 Profile Picture
    68,707 Most Valuable Professional on at

    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.

  • theMac Profile Picture
    on at

    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

  • Verified answer
    Pstork1 Profile Picture
    68,707 Most Valuable Professional on at

    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

    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?

  • Pstork1 Profile Picture
    68,707 Most Valuable Professional on at

    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

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

  • Pstork1 Profile Picture
    68,707 Most Valuable Professional on at

    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.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Copilot Studio

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 255 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 205 Super User 2025 Season 2

#3
S-Venkadesh Profile Picture

S-Venkadesh 101 Moderator

Last 30 days Overall leaderboard