Engine Works

Under the hood of Alteryx: tips, tricks and how-tos.
MeganDibble
Alteryx Community Team
Alteryx Community Team

This is the third article in the Reporting in Alteryx series. The first two articles are:

 

As much as corporate America likes to complain about email, it’s hard to do business without it. Email can be time-consuming. But what if you could use Alteryx to automate routine emails?

 

Enter: the Email tool.

 

Source: GIPHY

 

There are lots of interesting use cases for the Email tool—you can send an email when a workflow finishes running, you can set up emails for when something goes wrong in your workflow, or you can email out some version of the results of your workflow.

 

In the example I will walk through in this article, I email a summary data point and then attach an Excel sheet with the full data. Since Small Business Saturday is coming up next month, my use case is a small retail business with daily sales data from its POS system. If the store wants to email weekly reports to its stakeholders, it can use Alteryx to automate this process!

 

Building the Email

 

Before you start designing your emails and running your workflow, it’s important to note that there is an option to enable the Email tool in its configuration, which is checked by default. I recommend unchecking this option while developing your workflow so unnecessary emails are not sent. Then, you can check the box when you are ready to start testing.

 

Screen Shot 2022-10-17 at 3.47.57 PM.png

 

To set up the Email tool, you need to know the SMTP server name, port, and encryption for your organization's email system. If you get stuck, refer to the SMTP Troubleshooting knowledge base article and the Email tool help doc.

 

For the email components, you can either pull them from fields in your workflow or type them in the tool's configuration. For this article, I am pulling them from fields to make the example workflow more dynamic.

 

The Email tool will send an email for each row of data coming in, so make sure your incoming data is structured where each row has a different “To” email address (if there are multiple emails to send).

 

The from, to, and subject lines are easy enough—they are pulling from rows of data feeding into the tool. I used a Formula tool to create the header field based on the date in the input data. (Note: the data below is dummy data so that the workflow attached doesn’t send out emails to real people.)

 

Screen Shot 2022-10-17 at 3.57.22 PM.png

 

Screen Shot 2022-10-17 at 3.44.28 PM.png

 

I constructed the body field in a Report Text tool. This allows for including data fields in the text and more formatting options than a formula tool. I could get my email to look exactly like I wanted it to within the tool. I can even personalize the emails by including the recipient's name from my dataset—pretty cool!

 

Screen Shot 2022-10-18 at 3.03.11 PM.png

 

Now that we have the email components built out, let’s look at how to attach data.

 

Attaching the Data

 

I wanted to dynamically attach whatever is in the full input dataset. To do this, I first created the file name with the formula tool using the earliest date in the dataset. Then, I wrote the data using the “Change Entire File Path” option.

 

Screen Shot 2022-10-18 at 3.41.36 PM.png

 

Screen Shot 2022-10-18 at 3.41.58 PM.png

 

With this structure, you can receive new data each week and not have to update the workflow because the attachment data will be saved as a new file with the date in the file name.

 

Since I wanted to write the attachment data and send the email in the same workflow, I used the Block Until Done tool to ensure the data was written before any downstream process ran.

 

Screen Shot 2022-10-18 at 3.47.35 PM.png

 

I used the same file path (minus the sheet name) to attach the data to the email. Inside the email tool, under the attachments section, I clicked the add button. Then I configured the attachment as seen below:

 

Screen Shot 2022-10-18 at 3.49.28 PM.png

 

This way, the same data written earlier in the workflow will be attached to the email.

 

Sending the Email

 

On to the final piece—testing the email! Time to check the Enable option in the Email tool configuration.

 

I sent the email to myself for testing, and here is the result:

 

Screen Shot 2022-10-18 at 3.52.41 PM.png

 

I kept the email pretty simple, but I hope you can see through this example how powerful this tool is for automating business processes!

 

You could utilize some other reporting tools, like the Image, Table, or Interactive Chart tool, to include even more in the body of your emails. And if you had a different dataset to send to each recipient, you could put the email tool into a macro.

 

Hopefully, this short series on Reporting tools has shown you some new ways to streamline and automate your processes with Alteryx!

 

Is there a topic you would like me to write about next? Leave it in the comments :)

 

 

Resources:

Tool Mastery | Email

SMTP Troubleshooting

Megan Dibble
Sr. Content Manager

Hi, I'm Megan! I am a Sr. Content Manager at Alteryx. I work to make sure our blogs and podcast have high quality, helpful, and engaging content. As a data analyst turned writer, I am passionate about making analytics & data science accessible (and fun) for all. If there is content that you think the community is missing, feel free to message me--I would love to hear about it.

Hi, I'm Megan! I am a Sr. Content Manager at Alteryx. I work to make sure our blogs and podcast have high quality, helpful, and engaging content. As a data analyst turned writer, I am passionate about making analytics & data science accessible (and fun) for all. If there is content that you think the community is missing, feel free to message me--I would love to hear about it.

Comments
DataNath
17 - Castor

This is a great walkthrough and covers many parts of the process that often come up in the Designer discussions - super handy to now have this resource that we can refer people to!

Emmanuel_G
13 - Pulsar

Great article ! Very interesting !

SBK
7 - Meteor

Very helpful - thanks a lot!

RSHARDIN1174
5 - Atom

THis was exactly what I was looking for to beable to enable email to a internal customer of my workflow.  Thank you.  I need to and hope I can configure the SMTP at my company.  That is the next hurdle.

BMartinCOE
6 - Meteoroid

Thank you for this post. I am curious if you could help me understand how to go from generating 100s or reports to then emailing those reports their respective associated emails, where email is a field in the data set. Thanks!

MeganDibble
Alteryx Community Team
Alteryx Community Team

Hi @BMartinCOE! My first thought is that you can essentially create a workflow like I did in this article for one report and email, and then once you confirm it's working, convert it into a batch macro where you have 100 records as your input, each with the different email and any unique data or criteria (if each report is to be different). If each report has the same contents, then all you need in the input is the 100 emails.

 

MeganDibble_0-1705421678966.png

(here is the basic flow for one email, which could serve as the basis for your batch macro)

 

nikpatel01
5 - Atom

Hi @MeganDibble

 

I have workflow which zip all output excel files into one zip folder called "Files.7z". I want to send this zip folder as email attachment.  I used run tool to create a zip folder and it's working fine

.

Can you help me, please? 

 

 

Regards,

Nik Patel