Alteryx Designer Desktop Discussions

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

Input Multiple .CSV with different rows and column headers

R_L
7 - Meteor

Alteryx Newbie here.

I have a multiple data file that are in a CSV format within the same directory folder.  

They are quite similar, but involve columns and sometimes different row headers.

 

Example:

CSV 1: FileName: FruitStore_Canada.csv

FruitsStore AStore BStore CStore D
ApplesYesYesYesNo
OrangesYesNoNoYes
BananaNoYesYesNo
PearNoNoNoN/A
GrapesNoNoYesN/A

 

CSV2 FileName: Fruit Store_USA.csv

FruitsStore EStore FStore GStore HStore I
ApplesYesNoNoYesYes
OrangesN/AYesYesYesNo
PearYesNoNoYesYes
GrapesN/AYesN/AYesN/A

 

I am interested in combining them into one table. However, as they are a different schema - I've having trouble getting it to work. I've tried using a Batch Macro, however, it only "unions" and drops the first header row from the second CSV.

In the example CSV above, I know that there will definitely be different stores in the Column Headers. In-terms of the Row Headers, there will be some identical Fruits, but there may also be missing or extra Fruits as I add in more additional CSV as input in the future.

 

Ideally, I would like something like the below:

FruitsStore AStore BStore CStore DStore EStore FStore GStore HStore I
ApplesYesYesYesNoYesNoNoYesYes
OrangesYesNoNoYesN/AYesYesYesNo
BananaNoYesYesNo[Null][Null][Null][Null][Null]
PearNoNoNoN/AYesNoNoYesYes
GrapesNoNoYesN/AN/AYesN/AYesN/A

 

Any help appreciated! I think it's something I have to change in the batch macro, but I'm not too sure. Perhaps nested batch macros?

 

Thanks!

2 REPLIES 2
DavidP
17 - Castor
17 - Castor

So does your batch macro present you with something like this?

 

fruits.png

 

In that case you can use a transpose and crosstab tool to convert it to this:

 

fruits2.png

Thableaus
17 - Castor
17 - Castor

Hi @R_L 

 

The issue you reported building your batch macro is not a real problem. It's just because you probably did not connect your result with a browse tool (that's why only the first header row was showing up).

 

Anyways, I tried to simplify the batch macro and overcomplicated a little bit the workflow itself, but here's the solution that I thought.

WF appended.

CSVmultipleschemas.PNG

Cheers,

Polls
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Labels