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

Retain sheet name when using a batch macro input

Kearnd967
7 - Meteor

I want to use a batch macro to bring in multiple sheets from the same excel file.  They are all structured the same but have different sheet names.  I would like to retain the sheet name in the joined data.

 

I am really struggling with this one, any help would be greatly appreciated.

 

David.

 

 

 
 

 

 

14 REPLIES 14
Kearnd967
7 - Meteor

This is all I have at the moment.  I am quite new to macros.

Kearnd967
7 - Meteor

Thank you.  It works in the macros, but doesnt work properly in the workflow.  It brings through all sheets with the same sheet name.

OllieClarke
15 - Aurora
15 - Aurora

@Kearnd967 you'd need to have the fullpath of the file and the sheetnames in it entering your control parameter for your macro.

If these sheets are all in the same excel, and have the same schema, then you could use the dynamic input tool as I've done in the attached workflow

 

image.png

DataNath
17 - Castor
17 - Castor

Ah @Kearnd967 I can see the problem now. At the minute you're bringing in a single sheet, getting the full FilePath of that and then passing that to your batch macro, so the batch macro once again just brings in this single sheet, hence why you're only seeing that come out.

 

What you need to do is:

1) From the Input Data tool in your main/outside workflow, under 'Table or Query', select 'Import only the list of sheet names'

2) Pass this list of sheet names to the control parameter

3) In your action tool in the macro, tick the 'Replace a specific string' option and reduce the text in the box below so it's only the sheet name i.e. CL0002 - nothing else

 

Now when your batch macro runs, it'll run an iteration for each sheet, replacing the final (sheet) part of the filepath each time.

Kearnd967
7 - Meteor

Thank you both so much.  I now see the error and it is working as expected.

Labels
Top Solution Authors