Alteryx Designer Desktop Discussions

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

Macro to import multiple excel files

yilingchen02
Asteroide

Hi there,

I have a folder called students and each excel file contains information of one student. Sth like this

 

Alice.xlsx  tab 'Sheet1'

Height 160

Weight 100

 

Bob.xlsx tab 'Sheet1'

Height 170

Weight 110

 

Charlie.xlsx  tab 'Sheet1'

Height 180

Weight 120

 

I would like to combine these excel files into one, see below:

 

Height 160 Alice

Weight 100 Alice

Height  170 Bob

Weight 110 Bob

Height 180 Charlie

Height 120 Charlie

 

Does anyone have a macro template that handles this? 

 

Thanks,

Yiling

8 RESPUESTAS 8
alexnajm
17 - Castor
17 - Castor

You shouldn't need a macro if they are all the same structure and all have the same sheet name - try out a wildcard in the name, i.e. *.xlsx in place of Alice.xlsx in the Input Data tool

yilingchen02
Asteroide

Thanks. Would you be able to show a sample workflow? 

alexnajm
17 - Castor
17 - Castor

If you can pass on the data then sure! Otherwise the first option here goes over it: The Ultimate Input Data Flowchart - Alteryx Community entrée de données eingabedaten

yilingchen02
Asteroide

Thank you. Upon further checking, one file had one fewer column than the rest files. How to deal with this? I tried the Input Data Tool (first option) and the macro (third link), can't fix the issue. Error looks like this "Bob.xlsx|||'Sheet1$'" has a different number of fields than the 1st file in the set and will be skipped

alexnajm
17 - Castor
17 - Castor

Ah yes, if the structure differs then the batch macro option will work. Can you pass on the data so I can create a solution?

yilingchen02
Asteroide

Thank you. I attached the sample input file to illustrate. Please let me know if you have any questions.

 

alexnajm
17 - Castor
17 - Castor

Here it is (edited)

yilingchen02
Asteroide

It worked! Thank you so much

Encuestas
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!
Etiquetas