Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Add sheet name when importing multiple sheets using macro

Carlyn
8 - Asteroid

Hi

I am working on a macro to import multiple sheets from an excel file.

I tried Dynamic input initially, but as the tabs have different schema this wouldn't work.

So next option is a Macro.

It appears to have worked, however, I am looking to add a column with the sheet name on the output.

Can someone help me with how I can do this please?

9 REPLIES 9
OTrieger
14 - Magnetar

@Carlyn 
You need to select to open in the input data tool, 5 Output File Name as Field, select file name

ChrisTX
16 - Nebula
16 - Nebula

Inside the macro, in the Macro Input tool, under Template Input > File Input > Configure, use the drop-down for 5 Output File Name as Field.

 

Screenshot 2024-09-11 063940.png

 

Chris

Carlyn
8 - Asteroid

Hi Chris

Thanks for responding. I am not particularly comfortable with macros yet in Alteryx so this may seem like a daft question, but when I change to using the macro input tool and then try to link  it within my workflow by replacing the general input tool, there is no way to connect it that I can see. 

 

Macro Input tool.PNG

 

When I try to update option 5 in the general input tool I get the following error.

 

Input tool.PNG

 

Macro input.PNG

 

 

Do you know what I am missing/doing wrong?

 

OTrieger
14 - Magnetar

@Carlyn 

The path is wrong and that is the error that you get.

OTrieger
14 - Magnetar

check the formula tool as there path is been set there. You need to get a full path, .......file,xlsx|||Sheet1  or something like that, depends on the sheet name

OTrieger
14 - Magnetar

Does your Data input tool is set for List of Sheet Names?

OTrieger
14 - Magnetar

As you can see from the formula tool that to get the full path <List of Sheet Names> is been replaces by Sheet Name.

ChrisTX
16 - Nebula
16 - Nebula

@Carlyn see if this helps you:

 

How To: Import Multiple Excel Sheets or a Specific Excel Range into a Workflow

https://knowledge.alteryx.com/index/s/article/How-To-Import-Multiple-Excel-Sheets-or-a-Specific-Exce...

 

And an example here in the Solution to weekly challenge #412: Superbowl Time —Lowest-Ranked Football Positions:
https://community.alteryx.com/t5/Weekly-Challenges/Challenge-412-Superbowl-Time-Lowest-Ranked-Footba...

 

Chris

JosephSerpis
17 - Castor
17 - Castor

Hi @Carlyn have a look at the marked solution in this post.

Labels
Top Solution Authors