Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Answered

Read Excel File with a Flow and return output

(0) ShareShare
ReportReport
Posted on by

I was looking to create a flow in a chatbot that reads through an excel file and returns information. Specifically, it is for users to ask what an acronym means.

Ideally, it will work something like this:

User inputs the acronym they do not understand

ChatBot goes to an excel file with all acronyms and definitions listed

ChatBot returns the correct definition for the acronym

 

What would be the best way to achieve this (if possible)

  • Community Power Platform Member Profile Picture
    on at
    Re: Read Excel File with a Flow and return output

    Trying to call the flow from power virtual agents if possible.

    Received this error regarding the foreach loop, not sure how best to solve.

     

    lpn11_0-1658520465806.png

     

  • v-yujincui-msft Profile Picture
    on at
    Re: Read Excel File with a Flow and return output

    Hi @Anonymous ,

     

    I am afraid that there is no out-of-the-box Action or expression to achieve this in Power Automate currently.

    Sorry for any inconvenience.

     

    Best Regards,
    Charlie Choi

  • Community Power Platform Member Profile Picture
    on at
    Re: Read Excel File with a Flow and return output

    Not sure if its possible, but ideally I would like the syntax to not require the colon prior to the acronym.

    Is it possible to get the flow to work like this:

    User inputs the desired acronym to be looked up anywhere in the text
    (ex: What does AAA mean; What is the definition of AAA; What does the acronym AAA stand for; etc)

    No matter where it is in the original message, the flow continues to match it with the excel data and correctly outputs the definition message.

     

    I am not familiar with the best way to implement this, as I don't believe regex is supported by power automate? 

  • v-yujincui-msft Profile Picture
    on at
    Re: Read Excel File with a Flow and return output

    Hi @Anonymous ,

     

    The colon is added to make it easier to extract the acronym that needs to be queried.

    You could use your own way, just make sure the message contains the keywords you need to trigger the flow, and you are able to extract the acronym in the message.

     

    Best Regards,
    Charlie Choi

  • Community Power Platform Member Profile Picture
    on at
    Re: Read Excel File with a Flow and return output

    Does the input have to be split about the ":", or is there a way to have the trigger message include the acronym anywhere? Right now, it works only when the acronym directly follows a colon, not sure if there is a way to trigger it no matter where it is in the input?

  • v-yujincui-msft Profile Picture
    on at
    Re: Read Excel File with a Flow and return output

    Hi @Anonymous ,

     

    Maybe you could try the 'When keywords are mentioned' Trigger.

    trim(last(split(body('Parse_JSON')?['body']?['plainTextContent'],':')))
    {
     "type": "object",
     "properties": {
     "@@odata.context": {
     "type": "string"
     },
     "id": {
     "type": "string"
     },
     "replyToId": {},
     "etag": {
     "type": "string"
     },
     "messageType": {
     "type": "string"
     },
     "createdDateTime": {
     "type": "string"
     },
     "lastModifiedDateTime": {
     "type": "string"
     },
     "lastEditedDateTime": {},
     "deletedDateTime": {},
     "subject": {},
     "summary": {},
     "chatId": {},
     "importance": {
     "type": "string"
     },
     "locale": {
     "type": "string"
     },
     "webUrl": {
     "type": "string"
     },
     "policyViolation": {},
     "eventDetail": {},
     "from": {
     "type": "object",
     "properties": {
     "application": {},
     "device": {},
     "user": {
     "type": "object",
     "properties": {
     "id": {
     "type": "string"
     },
     "displayName": {
     "type": "string"
     },
     "userIdentityType": {
     "type": "string"
     }
     }
     }
     }
     },
     "channelIdentity": {
     "type": "object",
     "properties": {
     "teamId": {
     "type": "string"
     },
     "channelId": {
     "type": "string"
     }
     }
     },
     "attachments": {
     "type": "array"
     },
     "mentions": {
     "type": "array"
     },
     "reactions": {
     "type": "array"
     },
     "messageLink": {
     "type": "string"
     },
     "threadType": {
     "type": "string"
     },
     "teamId": {
     "type": "string"
     },
     "channelId": {
     "type": "string"
     },
     "body": {
     "type": "object",
     "properties": {
     "contentType": {
     "type": "string"
     },
     "content": {
     "type": "string"
     },
     "plainTextContent": {
     "type": "string"
     }
     }
     }
     }
    }

    vyujincuimsft_0-1658111956602.png

    vyujincuimsft_1-1658112018322.png

    vyujincuimsft_2-1658112118162.png

    Result Screenshot:

    vyujincuimsft_3-1658112255640.png

     

     

    Best Regards,

    Charlie Choi

  • Community Power Platform Member Profile Picture
    on at
    Re: Read Excel File with a Flow and return output

    Is there a way to trigger the flow without using the more actions tab for a given message? Can a power virtual agent chatbot call the flow already created?

  • Community Power Platform Member Profile Picture
    on at
    Re: Read Excel File with a Flow and return output

    Nevermind, I realized I had accidentally typed a v before the value insert, which was giving me the error. Got it to run all good, thank you so much!

     

  • Community Power Platform Member Profile Picture
    on at
    Re: Read Excel File with a Flow and return output

    In the apply to each section when entering the column names in the message, it is auto applying a for each with 2 apply to each calls and I received this error:

    The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression 'v@{outputs('List_rows_present_in_a_table')?['body/value']}' is of type 'String'. The result must be a valid array.

    lpn11_0-1657801375338.png

     

  • v-yujincui-msft Profile Picture
    on at
    Re: Read Excel File with a Flow and return output

    Hi @Anonymous ,

     

    Maybe you could check if the code in the filter query is correct.

    vyujincuimsft_0-1657765650399.png

    In addition, the dynamic content used in the filter query is related to the id of the Input.Text

    vyujincuimsft_1-1657765761350.png

     

    Best Regards,

    Charlie Choi

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,670 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow