In an earlier blog we began to explore the wonderful world of macros. Here we learnt that there were 3 types of macros available to use in Alteryx. We’ve already covered standard macros in Alteryx Tip: What are Macros? And how are they useful to me? Part 1 of 3 – The Data School Australia, so today we will be learning about batch macros!

What are they?

A batch macro runs for each record or “batch” of records in a workflow and then unions the results to form an output. This is particularly beneficial when you are working with large, repeated jobs. Users can replace their hours of manual efforts with this macro to slice their work time to a fraction of the original.

Let’s look at our example

Say our shelter (the example from the previous blog) has two locations. Each location is made up of several sections where the animals are housed. The organisation would like to count the number of animals at each section and repeat this process for each location. Let’s investigate how we can do this.

Here is our data:



Let’s start off by creating our workflow to clean up the data for just one of the locations for now.


Now that our workflow is cleaned, we want to add our interface tools. Now here we need to add a tool called a control parameter as this allows us to configure our batch macro. From this point we can utilise our update value tools by connecting them up to our control parameter. Here, we want to update import sheet so that we can extract both of those tabs, and we want to update our placeholder to tell us whether it’s location A or B.


We need to ensure we select the file source on the update value above the sheet and ensure that replace a specific string is checked, so we can tell Alteryx to only change the Location A part. Similarly for the placeholder, ensure that there are no quotations.

Now we add a macro-output and save our macro. Finally, to test our macro, we want to input the data file again on a new worksheet but select import only list of sheet names. As this is what we want Alteryx to update in that first update value we created. Insert your macro and select sheet names in the drop down and run your workflow.


As we can see now, we have just cleaned and extracted both tabs from that excel file with the use of this batch macro!

Kavita Nand
Author: Kavita Nand