Forum Discussion

Hogstad_Raadgivning's avatar
Hogstad_Raadgivning
Iron Contributor
Mar 30, 2021

Post a Teams message, when Excel online criteria is met.

Hi,

 

The idea/problem I would like to solve is to post a message everyday if a criteria is met.

 

Th Excel online Sheet

 

Column "Bursdag i dag" (Birthday today) is set to yes ithe person have birthday.

 

The flow:

 

Scheduled to run everyday

 

Check if the column is "ja"

 

Post a message at Teams:

 

I Guess the way I check column value in Excel is wrong here. Is this scenario possible? If yes, how do I configure it?

 

Best Regards

- Geir

 

2 Replies

  • RobElliott's avatar
    RobElliott
    Silver Contributor

    Hogstad_Raadgivning I would do it a different way so you don't have to manually check the spreadsheet and add in if it's the person's birthday - you can get the flow to check that.

     

    Make sure your spreadsheet has the full date of the next birthday and that the rows are formatted as a table:

     

    In your flow, as you've realised, you need to use the List rows present in a table action:

     

     

    Then add an apply to each and select value from the dynamic content.

     

    Next add 2 Compose controls:

    1.  I've renamed the first one to ConvertedDate and its purpose is to convert the date from Excel's integer format to something you can use in the flow. So you need an expression which will be:

    formatDateTime(addDays('1900-01-01', add(int(items('Apply_to_each')?['NextBirthday']),-2)), 'yyyy-MM-dd')

     

    When you are comparing dates you must always have them in yyyy-MM-dd format.

     

    2. The second Compose, called Today, gets today's date and puts it into yyyy-MM-dd format for the comparison. The expression is 

    formatDateTime(utcNow(),'yyyy-MM-dd')

     

     

    Finally, add a Condition to check if the converted date is the same as today's date. In the left field select the ConvertedDate output from the dynamic content, and in the right field select the Today output from the dynamic content.

     

    In the green if yes channel add your Teams Post a message action

     

     

    And this is the result in your Teams channel:

     

    Rob
    Los Gallardos
    Microsoft Power Automate Community Super User

     

Resources