Exercise - Create recurring flows

Completed

In this unit, you'll learn how to build prescheduled flows by using a trigger called recurrence. Contoso has an annual event and they receive phone calls inquiring on the details. The Contoso team answering the phone calls places the contact information in a Microsoft Excel workbook on Microsoft OneDrive. You'll build a flow for the Contoso event team that automatically pulls customer email addresses from a Microsoft Excel workbook on Microsoft OneDrive. You'll then set up the flow so that any email addresses that anyone adds to the workbook will receive an event information email once a day.

Prerequisites

For this scenario, you'll create an Excel file with a table that contains the following columns: ContactEmail, FirstName, and LastName. Save the Excel file in OneDrive. You'll connect to this file in step 9. Use your organization email address as the ContactEmail, using your email will make testing the flow easier.

Format an Excel Table

  1. Highlight all the cells that contain data.

  2. Select the Insert tab.

  3. Select the Table option.

  4. Make sure "My table has headers" is checked.

  5. Select Ok.

  6. Save the file in OneDrive.

Screenshot of formatting an Excel table.

Here’s what the Excel table looks like after being formatted:

Screenshot of the Excel table.

Create a scheduled flow

  1. Sign in to Power Automate by using your organizational account.

  2. Make sure you are in the correct environment.

  3. In the middle of the screen, type Create a flow that runs daily, gets a list of excel rows and for each row, send an email. Select Generate.

    Screenshot of the Power Automate home page and the words Create a flow that runs daily, gets a list of Excel rows and for each row, send an email.

  4. Copilot will do its best to come up with a flow and its actions from the description.

    1. If Copilot provided incorrect actions, you can continue to refine the flow actions in this top box.
    2. In this example, Copilot added a List rows present in a table (Excel) action, a For Each action and within the For Each, a Send an Email action.
    3. Review the actions Copilot generated and select Next.

    Screenshot of Copilot generated flow with a recurrence trigger, get rows from Excel action, a for each action and a Send an Email action.

  5. Select the Recurrence trigger to open the properties panel on the left and to verify Copilot set the correct parameters.

    Note

    Be mindful of the repeating module you select and how often you would like the flows to run. In the below example, the flow runs daily at 10:00 a.m. You can set these options however you like.

    Screenshot of parameters for the recurrence trigger demonstrating the interval is 1, frequency is every 1 day, and at these hours is 10.

  6. Select the List rows present in the table action to open the properties panel on the left.

    1. In the Location field, select OneDrive for Business.

    2. In the Document Library field, select the drop-down arrow and select OneDrive.

    3. In the File name field, select the folder button, and then select the Excel file to use. In this case, it's Book1.xlsx

    4. In the Table name box, select the drop-down arrow, and then browse to and select the table to use. In this case, it's Table1

    Screeshot of the properties panel of the List rows present in a table action.

  7. Next, we want an email to be sent to each contact in the Excel file. Copilot automatically puts our Send an email action inside of a For Each action so we only need to configure the Send an Email action.

    1. Select the Send an email action to open the properties panel on the left. Click inside the To field and select Enter custom value.

      Screenshot showing the Enter custom value button.

    2. Type / and then select Insert Dynamic Content.

      Screenshot showing the insert expression button.

    3. Select ContactEmail.

      Screenshot showing the contact email field.

    4. Enter Contoso Event Information for Subject.

    5. Type Dear in the Body and then type /, and select the Insert Dynamic Content button.

      Screenshot showing the insert dynamic content button.

    6. Select FirstName from the dynamic content pane.

    7. Press ENTER and then type Thank you for your interest in Contoso's annual event. As information becomes available, you'll be the first to know!

    8. The Send an email step should now look like the image below.

      Screenshot showing the send an email step.

  8. Select Save and wait for the flow to be saved.

  9. Your cloud flow should now look like the image below. Select Test.

    Screenshot showing the test icon and where to click to run the flow.

  10. Select Manually and then select the Test button.

  11. Select Run flow.

  12. Select Done.

  13. The flow should run successfully.

    Screenshot showing a successful flow run.

  14. You should receive and email like the one below.

    Screenshot showing email sent by the cloud flow.

And there you have it!

This flow will now run once a day. It will:

  • Get the rows from the Excel worksheet

  • Grab the email address and name from each row

  • Enter the email address and name in the email, and send them an event information email

  • Save you from manually composing emails to each interested caller.