Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Merging multiple files together with different number of columns.

AshaCharis
7 - Meteor

Currently I am using a batch macro process to combine files on top of each other, however each file has a different amount of columns, and my batch process only looks at matching the same column in the same space each time. Files are continuously added to the folder every day, so the merged file is updated 2x a day through the gallery.

So when the batch process runs on my files, the macro doesn’t see the same column titles to stack on top of each other, so it ends up creating new columns.

 

I would like to stack the same columns on top of each other and be able to add any columns that are new in the merged file. 

 

I have attached some sample data for clarity. 

15 REPLIES 15
rkapoor
Alteryx
Alteryx

@AshaCharis I was testing out a macro built by @apathetichell on your Excel sheets and I think it produces what you want as attached.

atcodedog05
22 - Nova
22 - Nova

Hi @apathetichell ,

 

You should publish this on Alteryx public gallery 🙂

apathetichell
20 - Arcturus

@atcodedog05  - Done ! - thanks for the support @rkapoor.

AshaCharis
7 - Meteor

Thank you so much for your help.

 

The files that are coming in are in .csv; do I just need to create another empty file sample the batch off of?

AshaCharis_0-1627339311655.png

 

apathetichell
20 - Arcturus

oh - that is a totally different project and a bit easier.... My macro is for different schema .xlsx/.xls - try the attached for .csv

apathetichell
20 - Arcturus

oh - did you want a combo macro which reads in any of .xlsx,.xls or .csv? It's possible but I haven't done it yet

AshaCharis
7 - Meteor

In the macro I wanted it to do is to stack the same columns on top of each other and be able to add any columns that are new in the merged file, but the macro that you first provided seems to not like the fact that I am stacking csvs.

apathetichell
20 - Arcturus

Try this one...

 

@rkapoor- updated version which spits out filename and allows for .csvs to be read in...

rkapoor
Alteryx
Alteryx

Thanks for that @apathetichell 

Labels
Top Solution Authors