Alteryx Designer Desktop Discussions

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

Combine Many .csv into a single output file (.csv or xlsx - doesn't matter)

twildhart
7 - Meteor

I have searched for an answer to this and tried multiple ways and just can't seem to find an easy straightforward solution to a request it seems would be a common occurrence. I have a report that runs and dumps out multiple .csv files into a single folder. I certainly could go the effort of creating a workflow that has each file as an individual input and then combining via the Union tool... they all have the exact same structure and for now, the output is predictable. 

 

My problem is that the file names and the number of files may not always be the same. The structure and .csv file type will not change. With that stated I figure there has to be a way to just pull from the directory and combine it into one file. I've seen a few responses to similar requests but in each case, it seems to me they are overcomplicating the solution or they only answer it using a .xlsx format. The latter is a straightforward solution. There is something about the fact that these are .csv files that seems to complicate this solution. 

 

Does anyone out there have an idea/solution that solves without a complicated macro or do I just need to suffer through the first set up with all the output files in the workflow through the Union?

7 REPLIES 7
ArtApa
Alteryx
Alteryx

Hi @twildhart - If your files' schema is truly the same you can use masks "*" - to replace many characters or "?" - to replace one character:

ArtApa_0-1649371505023.png

 

In this case one Input Data tool will read all your csv files from your folder.

apathetichell
18 - Pollux

Point the directory tool at give this a try. If  you have to work with different csv formats adjust the input data tool in the batch macro for your schematic specifics.

Qiu
20 - Arcturus
20 - Arcturus

@twildhart 
There is a classic Macro in this community but I cannot file the thread now.
anyway, I modified it so i can work for CSV also.
and we can also simply use the input tools if your data schema is the same.

0408-twildhart-01.PNG0408-twildhart-02.PNG

soccertil1108
8 - Asteroid

The macro that I shared in this post along with the accompanying video will read any set of files regardless of data type, including a mix of data types. Check it out.

 

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Macro-for-Reading-Multiple-Files/m-p/9...

 

twildhart
7 - Meteor

Thank you for the response. While I was able to make this work with test data... I couldn't get it to work with my data. I think it is due to my lack of experience with Macros. I will keep it around if I run into a more complex situation like unmatched schema or different file types. 

twildhart
7 - Meteor

Thank you... this hit the spot. Nice and clean Macro... right-sized for what I needed and my limited experience with Macros. Worked like a charm! Thanks
 

twildhart
7 - Meteor

Sorry, this isn't the solution I meant to accept. I clicked on the wrong one... but thanks for trying to help. 

Labels