We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Alteryx - how to load multiple tabs using match macro

yilingchen02
8 - Asteroid

Hi there,

 

I have one excel file with many tabs that I need to load into Alteryx. They are similar but not identical (different schema). I am trying to adapt the batch macro from this post

https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/CS-Macro-Dev-Reading-in-Multiple-Fi...

But I kept receiving error messages saying file path is incorrect. Any idea where I could adjust filepath and how?

 

yilingchen02_0-1666366344371.png

 

Thanks,

Yiling

9 REPLIES 9
acarter881
12 - Quasar

Hi @yilingchen02. Thanks for linking that article. I have done something similar to the article. I see you need to edit your pathing since (for example) "GOOD" is not a file.

 

Here's a general flow that should work for you as well.

Spoiler
acarter881_0-1666367927923.pngacarter881_1-1666367953218.pngacarter881_2-1666367993550.png

 

 

yilingchen02
8 - Asteroid

Thank you. Where would be the place to edit path? Is it in Batch.yxmc? Thanks

acarter881
12 - Quasar

You're welcome. You may have to share the workflow or a sample of it. The FilePath variable seems to be incorrect.

 

That should be the entire file path (e.g., "C:\Users\alex\Downloads\forex_output.xlsx") and it may even include the sheet name (e.g., "C:\Users\alex\Downloads\forex_output.xlsx|||`Sheet1$`").

yilingchen02
8 - Asteroid

Sure. See codes and input excel below. My input Sample.xlsx has 3 tabs: each tab has one student and student's height and weight.

Tab 'Alice"

Height160
Weight

100

Tab 'Bob'

Height170
Weight110

Tab 'Charlie'

Height180
Weight120

 

Then I run the New Workflow4.yxmd to combine these into one file. I expected sth like

Height160
Weight100
Height170
Weight110
Height180
Weight

120

 

But instead I got this

yilingchen02_0-1666375265782.png

 

How can I tweak the code?

 

Thanks,

Yiling

acarter881
12 - Quasar

Hey, @yilingchen02. I believe the Batch macro is unnecessary. You can achieve the expected output by using a Dynamic Input tool.

 

Please see the spoiler and the attached workflow.

Spoiler
acarter881_0-1666376547320.png

 

yilingchen02
8 - Asteroid

I simplified my input here. My actual input has different schema hence I need to figure out how to use Batch Macro..

acarter881
12 - Quasar

I may need more information. However, try selecting "First Row Contains Data" in the Input Data tool inside the Batch macro.

 

Spoiler
acarter881_1-1666377810693.png

 

 

yilingchen02
8 - Asteroid

It did the trick! Thanks @acarter881

acarter881
12 - Quasar

You're welcome. Glad it worked.

Labels
Top Solution Authors