Alteryx Designer Desktop Discussions

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

Running Batch Macro on Files from Folder and Outputting Onto One Single File

macst245
8 - Asteroid

I have gone through many example batch macro threads here, but since I am new to Alteryx, therefore I am finding it a bit complicated to execute correctly in my case. Specially the part where we have to create the "Control Parameter Step" and update it with new file names, so that the process can be repeated on multiple files. I am having trouble trying to find the best way to create a batch macro which will work in my case, so any help or suggestions would be greatly appreciated.


These files have the exact same structure and format and a constant schema throughout. So this should reduce the complexity of the batch macro.


I need to make sure that the complete workflow runs on the FIRST CSV FILE and generate the required output files, then the complete workflow runs on the SECOND CSV FILE and generate the required output files and this process continues, till the VERY LAST CSV FILE is processed in the given folder. All csv files are located in this same folder - "C:\Data\Batch Macro Sample Data".

 

I cannot first import all the csv files into a big table and then run the workflow. It has to be done, ONE FILE AT A TIME, separately and keep on repeating, one after the other, till all the files have been processed in that folder.

 

I have gone through a lot of different links, but have failed to create the desired output. I would really appreciate, if someone could take the sample data files that I have attached and create a workflow based on that, instead of just posting here the links to other threads.


To make it easy for you, I have attached three csv files having the sample data, on which this workflow needs to be run. Although the actual data files are quite big, having millions of rows in it, but I have made a very small sample out of it for sharing on the forum. All this data has a constant schema throughout.


I have also attached the Alteryx Worflow Package .yxzp file.

 

I will need the output to be a Single Excel Workbook File (.xlsx) with separate tab names, named after each input file i.e. Input File "File A" would be a new tab on the excel output file "File A" Input "File B" would be outputted as a new tab "File B" and so on.  

5 REPLIES 5
TheOC
15 - Aurora
15 - Aurora

hey @macst245 

I believe i have created what you need, please find attached and let me know.

TheOC_0-1647269738699.png



Directory tool to retrieve all files, and batch macro uses these files to output to single excel file. Be sure to right click the macro, and hit open macro, to see how it works.

TheOC_1-1647269782601.png

 



Any questions give me a shout!
TheOC




Bulien
TheOC
15 - Aurora
15 - Aurora

hey @macst245 
My sincere apologies - i forgot to attach the workflow.

Please find attached.
TheOC


Bulien
TheOC
15 - Aurora
15 - Aurora

hey @macst245 
Heres a version for 2021.1, if required, based on your private message.

Hope this helps,
TheOC


Bulien
macst245
8 - Asteroid

Thanks Very much for your help!  Also, is there a way to name the Output file with the date I am running the Macro, but still keep the tab names the original input file names?   

omkarshinde
8 - Asteroid

@TheOC any way to add filename as extra column with every record while reading multiple files via this batch macro?

Labels