Search code examples
automationmicrosoft-teamspower-automate

Read from Excel and post message to Teams channel


We have an Excel spreadsheet for an on-call rotator schedule. I would like to post a Teams message each Monday with the people assigned for that week.

Example spreadsheet:

Date Team 1 Team 2
7/4 X A
7/11 Y C
7/18 X B
7/25 Z A

Example Teams message:

On call for week of 7/4: X and A


The struggle I am having is reading the data from Excel. I can format the spreadsheet to something that works but I don't know how to extract the team member's based on the day. Is that possible to do with Power Automate?


Solution

  • You could use a Filter Query with an expression and the utcNow function in the list rows action.

    Below is an example of that approach.

    1. Add a Recurrence action
      a. Configure it to run every Monday

    2. Add a List Rows action
      a. Use the following value with an expression with a utcNow function for the Filter Query

      Date eq '@{utcNow('MM/dd/yyyy')}'

    3. Add a Post message in a chat or channel
      a. Use the following expression with a concat function for the Message field

      Concat('On call for week of ', utcNow('M/d'), ': ', first(outputs('List_rows_present_in_a_table')?['body/value'])?['Team 1'], ' and ', first(outputs('List_rows_present_in_a_table')?['body/value'])?['Team 2'])

    Flow Setup - Get Rota details from Excel and post to Microsoft Teams