Sending Emails from Excel with Microsoft Flow

In this post we’re going to learn how to send emails from Excel. It’s possible to do this using VBA, but that’s the old way from the 90’s and we’re in 2018.

We are going to explore Microsoft Flow. This is a new product from Microsoft that allows us to automate workflows between apps. It’s not just Microsoft Office apps that can be automated. There are a ton of third party connections available. We can easily create rules that automatically do things like:

  • Save any email attachments to a OneDrive folder.
  • Get a notification on your phone when someone updates a table in your spreadsheet.
  • Track all company Twitter mentions in a spreadsheet.
  • Sync your Outlook calendar to your Google calendar.
  • Forward emails to Slack.

The awesome part about Microsoft Flow is that it requires no code! We can design and build out your process (flow) in a couple minutes with an easy to use graphical interface.

In this post, we’ll be building a flow that schedules and sends an email template from Outlook based on the data in an Excel file.

Sign Up for Microsoft Flow

For this post, we’ll need to sign up for a Microsoft Flow account or sign into an existing Office 365 account.

There’s a free version which allows for 750 flows a month. If you have Office 365, then you already have Microsoft Flow and can use up to 2,000 flows per month.

Head to the Microsoft Flow website at https://flow.microsoft.com and click on either the Sign in or Sign up free button. Then either log in with your Office 365 credentials or provide the necessary information to create an account.

In the flow recipe we’ll be creating in this post, we’ll also need a OneDrive account. If you have Office 365, then you already have a OneDrive account. If not, then you can easily create a free one here https://onedrive.live.com.

A Quick Tour of Microsoft Flow

My Flows

In the My Flows tab of the site, we see all our flows listed that we have built. There’s a lot that can be done from this page.

  • There’s an icon that shows which connections have been used for the flow.
  • The name of the flow is listed.
  • We can deactivate a flow to temporality stop it from running.
  • We can share a flow with another user.
  • We can edit a flow.
  • We can create new flows either based on an existing template or starting from scratch with a blank flow.

Approvals

Flows allow us to create approval steps in our processes.

Imagine creating a flow to automatically email a quote generated from a spreadsheet to a potential client. You might want someone to review it and approve the email before it is actually sent. This is a step that can be added to any flow and is all managed from the Approvals tab.

Templates

A lot of what we may want to create might have already been built by the Microsoft team or someone else. In the Templates tab, there are a ton of pre-built flows that you can use as is, or customize for your use.

Click on any of the templates and see a more detailed explanation of what the flow does and what it needs to connect with to work.

Connectors

Connectors are the pieces you use to build out your automated process. In the Connectors tab, there are a ton of connections available for just about every popular online service including all the office applications.

There are many connections.

  • Office apps like Excel, Outlook, OneDrive etc…
  • Other Microsoft products like PowerApps and Power BI.
  • Google office productivity suite.
  • Twitter, Facebook, YouTube and other social apps.
  • Many other online tools.

We can click on any of the connections to see further details about what type of actions we can do with it.

Setting Up Our Excel File

The first thing we’re going to need to do is set up our Excel File in OneDrive. We can create a new Excel workbook in OneDrive and add data to it for use with our emails.

In this example, we’re going to be creating and sending emails from Outlook based on the data in Excel. For each row of data, we are going to be sending the client an email telling them the current account balance that is owed.

We don’t need to create the whole email in Excel, just the data for the parts that will be different for each email we want to send.

  • Date – We are going to delay sending out our emails based on this date.
  • Email Address – This is the email address we are going to send an email to.
  • Name – This is going to be used in body of the email to address the recipient by name.
  • Account Balance – This is going to be used in the body of the email to tell the recipient their current account balance.

We will need to add the data into an Excel Table, as this is the only Excel object that Microsoft Flow will recognize.

To create a table, we can select the data and go to the Insert tab and use the Table command. We can also use the Ctrl + T keyboard shortcut to create a table.

Once we have a table with our data, we need to make sure to give it a good name instead of the default Table1 name. With the table selected we can go to the Table Tools Design tab and give it a new name from the Properties section. We will name the table Emails.

This will make any flows created with the data a lot easier to understand later on. Proper column heading names will help later on too.

Creating Our First Blank Flow

When logged into Microsoft Flow, go to the My flows tab and click on the Create from Blank button. The next screen will show you some popular triggers to start your flow with, but we want a blank flow, so we can click on the Create from blank button again.

Adding Our Flow Trigger

The first thing we need to do when creating our flow is add a trigger. This is exactly what it sounds like, it’s something that will trigger the flow to execute.

In this case, we’re going to create a button that we can press from the Microsoft Flow app to run the flow.

  1. Search for button to narrow down the list of available triggers and find the mobile button.
  2. Select Flow button for mobile from the connection options.
  3. Choose the Triggers section of the results. Each connection might have several trigger and action options available.
  4. Click on the Flow button for mobile trigger.

Getting Data from Excel to the Flow

After we trigger our flow with the button, we’re going to want it to do something. These will be the actions we add in the next steps of our flow process.

The first action we want to do is get the data from our Excel table.

Click on the New step button to add the next step to the flow. Then select Add an action from the menu.

Search for Excel to narrow down the list of connections then select the Excel – Get rows action. This action will get all the rows of data from the specified table in a given workbook.

Now we can select the File name from our OneDrive using the file icon and then select the appropriate Table name from the drop down menu, our table was named Emails.

Creating a Delay Based on the Date Field in Excel

In this example, we want to send each email out at a particular date and time based on the Date field in the Excel data. We can add a schedule step into the flow to accomplish this.

Create a New step and Add an action. Then search for delay and choose the Schedule – Delay until action.

The delay step will require a timestamp input. We can hard code a single value here, but it’s also possible to Add dynamic content so the timestamp depends on the values in our Excel file. Note, that flow will interpret the timestamp data in Excel as being UTC.

Click into the timestamp input field and the dynamic content pop up will display.

Under the Get rows section of the dynamic content pop up, select the Date field from our Excel table.

When we add the date from our Get rows action, something sort of magical happens. Flow will automatically place the delay step inside an Apply to Each step. Flow realizes we don’t want to just perform our actions once, but we likely want to perform our actions for each row of data in the Excel table.

This is exactly what we want. We could have added this in ourselves before adding the delay step. But it’s nice to know it’ll tell us if we forget.

Create the Email Template for Each Row of Data

Now we are ready to add our email step after the delay. This will be added inside the Apply to Each step since we want to send an email for each row of the data in our table.

Press the Add an action button found inside the Apply to each step.

This time we can search for Outlook to narrow down the results and choose the Office 365 Outlook – Send an email action.

We can then create an email template, referencing fields from our data where appropriate. In the To input section we would add our Email Address field from our data since this contains the email address to which we want to send the email.

Add a Notification Step

Since this flow will delay the emails, we might want some sort of confirmation when each email is actually sent. For this, we could add a notification step. This will send us a notification when each email is sent.

Again, we want this step inside the Apply to each step, so press the Add an action button at the bottom of the Apply to each step. Search for notification to narrow down the results and choose the Notifications – Send me a mobile notification action.

We can then add Text to the alert to specify which email was sent.

To actually receive the notification on our mobile device, we will need to install the Microsoft Flow app. We can download either the Android app here or the Apple app here.

Saving and Naming the Flow

Now that we’ve finished building our flow process, we need to save it. Click on the Save icon in the upper right hand corner of the web app.

We’ll also want to give the new flow a descriptive name. Click on the default name found in the top left hand corner of the web app then rename it appropriately.

Running the Flow

Now that we’ve built our flow process, named and saved it, we are ready to use it. We can now run the flow a few different ways.

Since the trigger we created to run the flow was the mobile app button, we can run the flow from our mobile device with the app installed. Go to the Buttons section of the mobile app, then press the button for our email flow.

We can also run the flow from the web app in the My flows tab. Click on the 3 ellipse icon on the right side of the flow and choose Run now from the options.

Either method will start the flow.

If the date field is in the past, then those emails will be sent immediately. Future dates will have emails delayed. Even though future dated emails are not sent, they are still created by flow, so changing the data in the Excel table after running will not change future dated emails.

Conclusions

Microsoft Flow is simple to use and very powerful. We’re in the modern era and no longer need to be programmers to create useful automation’s that save tons of time.

We were able to easily create a flow that sends emails based on the data in a connected Excel table.

If you can use a mouse and have some ideas about processes you’d like to automate, then Microsoft Flow is meant for you.

I’d love to hear about all the cool things you build with Microsoft Flow, so let me know in the comments below!

About the Author

John MacDougall

John MacDougall

John is a Microsoft MVP and qualified actuary with over 15 years of experience. He has worked in a variety of industries, including insurance, ad tech, and most recently Power Platform consulting. He is a keen problem solver and has a passion for using technology to make businesses more efficient.

Subscribe

Subscribe for awesome Microsoft Excel videos 😃

John MacDougall

I’m John, and my goal is to help you Excel!

You’ll find a ton of awesome tips, tricks, tutorials, and templates here to help you save time and effort in your work.

Related Posts

Comments

14 Comments

  1. Joel

    How do you automate the flow to run automatically without having to manually press run now?

    • John

      I used the button trigger because it’s easy to test when building a flow. You can use any trigger you want, it just depends what you want to do. There are many other triggers we could use including schedules to run the flow every day at 9am.

  2. Pedro

    Hello!
    Very interesting article indeed! Thank you for your valuable infromation.
    I have many questions related to the use of flow together with excel I hope you may be able to answer.

    1) Do you know which is the difference between the function “Get Row” and “Get Rows”?
    2) When adding a condition, how would you reccomend using the advanced features to get a certain row on the grounds of a particular status? For instance, I would like to send an email when the status of a task is ‘COMPLETE’.
    2) Is there a way of automatically editing the cells we have used as a condition after certain option responses embeded in the body of an email are answered?

  3. DavidB

    Hi John,

    Thanks for a good Intro to MS Work Flow, WF. I’ve been experimenting with it at home (bought a domain, set up SharePoint, etc…) but hasn’t gone into details to try out.

    WF with SharePoint Online SPO will eliminate a lot of emails in my workplace. Unfortunately, the supervisor at this big oil is not open-minded (maybe ignorance/not knowing enough) with forward thinking about data analytics and automation. Therefore my home experiment out of my pocket $.

    Here is MS Flow update Aug 2018 – Introducing Microsoft Flow integration in Excel, https://goo.gl/hnHarw

    Just a couple ideas:
    1. Integration with QuickBooks would be beneficial to business owners to automate some criteria/tasks (get that table Account Balance table above, Invoice due in # days, etc..) on customer emailing.
    2. Get approvals on w workflow (big time saver)

    Never stop learning!

  4. ash

    Hi, great post.

    Please can you confirm if the flow continues to run until all the emails are sent? i.e it doesn’t actually complete straight away and continues running until the final future email date is surpassed?. I set some future dates in the column, and it doesn’t seem to complete, hence makes the testing interesting!

    • John

      As far as I’m aware, this is how it works. I tested it with a 30 minute delay and it worked.

      But keep in mind the further out, the more things can potentially happen to cause it not to run…

      • Ash

        Hi John,

        I am having issues with the date field being recognised in Microsoft flow, im getting this error ‘String was not recognized as a valid DateTime.’ at the delay until action step.

        DO you know how to fix this?

  5. Tyson Fernandes

    Why there is no Excel connector now?

  6. appaeconomicdevelopment.com

    What’s up, after reading this amazing article i am too
    delighted to share my knowledge here with mates.

  7. armand

    Hi

    how do I include attachment content from the excel table list

    Thanks

    • John

      You would need to have the link the the file from SharePoint or OneDrive in the Excel table, then get the contents of the file in Flow based on the link.

  8. Lena

    Hello, does it have to be triggered by a date? I’m considering using this app to be able to manually track product inventory and send an automatic email when the inventory is low or reaches a certain number. For example, can I set it so that if I have less than 5 chairs it sends an automatic email? Or does it have to be a date?

    • John

      No, you can set it up to be based on any values, not just dates.

Get the Latest Microsoft Excel Tips

Follow Us

Follow us to stay up to date with the latest in Microsoft Excel!

Subscribe for awesome Microsoft Excel videos 😃