How to create dynamic nested Outlook email templates from datasets

In Shared Email Templates for Microsoft Outlook

When dealing with frequently changing information, it can be a real pain to keep all your email templates up to date. But there's is a simple yet remarkably effective solution – combining template shortcuts and datasets.

The basic idea is this: For each data category, such as a specific item in your catalogue or a particular service you offer, you make a separate template and assign it a shortcut. These templates hold general, rarely changing information. Variable details like prices or expiry dates are stored in an Excel table. In that table, you also include shortcuts, connecting the "static" templates to the dataset. This way, you can automatically fill your emails with the most current information whenever you reach out to clients or team members. Sounds too good to be real? Let's break down the process into practical steps:

Video: How to use Excel table to create dynamic email template

How to use Excel table to create dynamic email template

Discover how to make an Outlook email template that changes dynamically based on Excel data. Learn a technique of nesting one template within another.

Run time: 05:36

1. Create static templates with shortcuts

Begin by crafting individual templates for different data categories, for example various trips and travels. Each template contains only generic information that doesn't change often, such as tour descriptions or itineraries. Avoid including any changing details like when the tour starts or how much it costs.

For every template, create its own unique shortcut, so you can access it easily whenever needed. To do this, just click on the ## symbols in the upper-left corner of the preview pane and type in the shortcut name.

These templates can look really nice when enriched with special text styles, pictures, tables, and other elements. In the image below, you can see a sample template for the "Coral Reefs" tour, and how it appears in an email.
Create a beautifully formatted email template and assign it a shortcut.

For more information, please see How to create template shortcuts.

2. Add variable data to an Excel table

Gather all variable details, such as prices, expiry dates, discounts, and other things like that, into an Excel table. Make sure to place the key values in the leftmost column. These will be the choices in a dropdown menu later, so each value in this column must be unique.

In our case, the first column contains tour names. Each tour has its own row, and each detail – like cost and duration – goes into a separate column. Remember to add a column where you list the shortcuts for the "static" templates, which contain a short overview of each tour.
Gather all variable details in an Excel table.

Tip. Instead of using an Excel table, you can input these details into a simple dataset, which is created within Shared Email Templates itself.

3. Connect your Excel table to a dataset

To use data from your Excel table in your templates, you need to create an Excel-based dataset. For this, right-click the target folder in the Shared Email Templates pane, select New Dataset, and then follow these instructions.

Once created, you'll find the new dataset in the selected folder. It will have a green Excel-like icon indicating its connection to an Excel table. In the preview pane, you'll also see the names of the source Excel file and table.
Connect an Excel table to a dataset.

It is important to note that this process does not import data from Excel into Shared Email Templates. Instead, it creates a flexible connection between the two. This means that any changes you make to the Excel table data will be automatically reflected in the dataset.

4. Build a dynamic template with dataset data

Now, let's delve into the most exciting part – creating a dynamic template that pulls relevant information from the dataset:

  1. Design your email template however you like. You can use placeholders to mark where you wish to put information from the dataset or leave those spots blank. In the image below, you'll notice five placeholders in square brackets.
    Mark where to insert information from the dataset using placeholders.
  2. Replace the placeholders with the WhatToEnter macro. For this, select the placeholder, click the Insert Macro button, and then select What To Enter from the list. In case you haven't created placeholders, simply place the cursor where you want the info from the dataset and insert the macro there.
    Replace the placeholders with the WhatToEnter macro.
  3. Configure the macro settings as follows:
    • In the first dropdown menu, choose Dataset.
    • Under Field name, type a short descriptive label such as "Select the tour". This label will become the name of the dropdown menu that shows up when using the template.
    • Choose the dataset where to look for the data.
    • Pick the column to get the value from.

    For instance, this is how you set up the macro that inserts a specific tour's shortcut:
    Set up the macro to insert a specific tour's shortcut.

  4. Insert the WhatToEnter (WTE) macro for other placeholders. When adding subsequent macros within the same template, you'll have the option to copy settings from another WTE. Select the name of the previously configured macro ("Select the tour"), and all your prior choices will be automatically replicated in the corresponding fields.
    Copy settings from another WhatToEnter macro.

    After the macro settings have been copied, don't forget to change the column from which to extract data, such as "Tour name", "Nearest date", "Duration", and "Cost".
    Choose the column from which to extract data.

When you're done, your template will have several macros, displayed in the DatasetName.ColumnName format in the preview pane:
An email template with several macros to dynamically pull relevant data from a dataset.

For more information, please refer to How to fill template with dataset values.

5. Dynamic template in action

And now, test your dynamic template in action and watch the magic unfold :)

When inserting the template into a message, a dropdown dialog will pop up asking you to select the tour:
Select the tour from the dropdown menu.

Once you've made your selection, all the relevant details will automatically appear in your message in the right places. The nested template shortcut works quietly behind the scenes, ensuring that the content of the smaller template is also included, with its own text styles, images, and other features.

Here's the cool part: even if your template has multiple WhatToEnter macros referring to the same dataset, you only need to make your selection once.

And there you have it! A welcome email that is attractive and informative, and tailored for your specific recipient:
An attractive and informative email tailored for a specific recipient.

The best thing about this approach is that if anything changes, like a price or itinerary for a tour, you'll need to update it only in one place – either in your Excel table or in the nested template. You won't have to go through all your templates to make the change. Give it a go, and you'll see how easy and efficient it is to manage your templates this way.

Post a comment

Seen by everyone, do not publish license keys and sensitive personal info!

If you have any questions or issues with this add-in, please feel free to post your concerns in the comments area. As soon as we answer, a notification message will be sent to your e-mail. If you do not want to share your thoughts in public, please contact us at support@ablebits.com.