Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Batch macro to filter countries and output to excel

DanielCarro
8 - Asteroid

Hi guys,

 

Need some guidance on a batch macro, saw some articles over this subject but didn't work.

 

So I have data from one file and there are around 70 countries, where I just want to split the countries into individual excel output which I have a template.

Important: the template has formulas so the data needs to be inserted into a range A4:U2500

 

On my workflow it works well but I don't really want to be doing the filtering for 70 countries but I am struggling with the batch macro

 

DanielCarro_0-1672243196983.png

 

Many thanks,

Dan

 

19 REPLIES 19
MatthewO
Alteryx Alumni (Retired)

@DanielCarro the attached workflow demonstrates how this can be accomplished with the Output Data tool. By replacing the output path with data from the workflow, you are able to write data dynamically to different sheets, or files. 

Kakuffo
Alteryx
Alteryx

HI @DanielCarro 

The attached screenshot shows the configuration required for the output data tool to output to seperate sheets (Change file table name with take file/table name from field)  in excel or files in other format types.

Kakuffo_0-1672249393110.png

 

DanielCarro
8 - Asteroid

Hi MatthewO,

 

Nearly, your output creates tabs alongside. But what I needed is the country to go to the template and to sheet1 and paste the data in the range. So one country per excel file. 

 

Kind Regards,

Dan

MatthewO
Alteryx Alumni (Retired)

@DanielCarro this can be accomplished with a small change to the file path created in the Formula tool. The attached version writes to different files.

DanielCarro
8 - Asteroid

@MatthewO  it still creating tabs for the countries

MatthewO
Alteryx Alumni (Retired)

@DanielCarro just confirming that you ran the workflow with the _v2 suffix. It generates 2 separate files when run on my end. The only change is that the value of the Output field is updated in the Formula. For use in your workflow, you will likely want to update "%temp%" with the appropriate directory. 

image.png

DanielCarro
8 - Asteroid

@MatthewO  following your guidance

 

in the second pic I get a C inside a bracket

the last pic is the extension of pic 2, wasn't able to capture all in one shot

 

Not sure where I might gone wrong

 

DanielCarro_1-1672254149962.pngDanielCarro_2-1672254226284.pngDanielCarro_3-1672254720397.png

DanielCarro_4-1672254872714.png

 

 

MatthewO
Alteryx Alumni (Retired)

@DanielCarro I think the issue is the configuration shown below. I would update this to "Change Entire File Path".

 

image.png

Felipe_Ribeir0
16 - Nebula

Hi @DanielCarro 

 

Please try this workflow. I shared this case in the gallery too, it is very useful i think: https://community.alteryx.com/t5/Community-Gallery/Copy-files-between-folders/ta-p/1056621

 

Just adapt it to your use case (the datasets/paths/range)

 

 

1-I have a default template

Felipe_Ribeir0_0-1672256567163.png

 

2-I am using a macro to copy this template for each country of my dataset

 

Felipe_Ribeir0_1-1672256626092.png

 

3-I am writting the data inside of each country/template

 

Felipe_Ribeir0_2-1672256666935.png

 

 

Labels
Top Solution Authors