ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
GELÖST

Merging multiple files together with different number of columns.

AshaCharis
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 ANTWORTEN 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
Arcturus

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

AshaCharis
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
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
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
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
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 

Beschriftungen
Top-Lösungs-Autoren