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.

Update Import Excel File with Multiple Sheets through Batch Macro Update Both

Nmassarone
8 - Asteroid

Hello, I'm new to the whole Batch Macro thing and hoping someone can help with this question. I have looked all over to see if there is anything like this but cant seem to find anything. I looked into using the Dynamic INPUT but the thing is not all columns are the same and always got an error when trying to import that the Schema was not the same.

 

The is the closest I got to doing what i want to do but get hung up when trying to change the input file.

 

i have a APP Workflow my team runs weekly it compares to an excel file with multiple Sheets. I found online a batch macro that can pull in multiple sheets and join them all into 1 list which is fine.

 

The only thing is that INPUT FILE has to be updated on a weekly basis that I put into a File Browse Interface. The only thing is once the sheet is updated in the APP the INPUT Tool in the MACRO no longer matches the input sheet and kicks back an error.

 

Is there a way to update the input File in the App alongside with the INPUT inside the MACRO?

 

Any help would be appreciated.

 

Thank you

 

Nmassarone_0-1675270577161.png

 

MACRO

Nmassarone_1-1675270604337.png

 

6 REPLIES 6
apathetichell
20 - Arcturus

Dude - you have to include screen grabs of your action tool configs - not your workflow. Basically formula tool in outer app replaces "<List of Sheet Names>" with the actual sheet name so you are feeding in "myexcelfile.xlsx|sheetname" - looks like your action tool in your inner macro isn't configured properly to update the input data filename.

 

make sure you've set up your inner (And outer macro) to adjust schema based upon unioning by Name (in interface designer)...

apathetichell
20 - Arcturus

Also change  "List Of Sheet Names" to "List of Sheet Names"

Nmassarone
8 - Asteroid

It was more of a basic question if there's a way to use the Interface File Browse to update both the Input on the APP and the MACRO.... Should the Macro just be a guide or a template? should it not have to be updated if the INPUT on the APP is updated?

 

These are the screengrabs of the action configs.....

 

Nmassarone_0-1675272951612.png

 

Nmassarone_1-1675272971616.png

 

Nmassarone_3-1675273013892.png

 

 

 

 

Nmassarone_2-1675272989758.png

 

 

inside the APP

Nmassarone_4-1675273111978.png

 

 

Action Tool 

Nmassarone_5-1675273127007.png

 

 

Nmassarone_6-1675273143392.png

 

i use the formula to generate the full path with the sheet name to get everything into the macro to output all sheets to 1 table

 

Nmassarone_7-1675273162693.png

 

 

Nmassarone_8-1675273216134.png

 

 

Nmassarone_9-1675273273479.png

 

 

This flow works if i keep the File the same on the Macro and the APP. As soon as I change the file on the APP it kicks back the error saying does not match sheet or named.

 

If this should work without having to change the INPUT file on the macro then it might just be something I'm doing wrong like if the INPUT inside the MACRO is just a reference.

apathetichell
20 - Arcturus

Your setup seems o.k. - I'd recommend changing your action tool to simplify it inside of your macro. Your flow is mostly correct though.

filebrowse - action tool - input data (list of sheet names) in your outer macro. replace the list of sheet names with the sheet - feed in via control parameter to inner macro and update input data file there.

 

input inside the macro should be a template/test data which should work - but it should be updated on execution.

 

try changing your regex_replace to a vanilla replace. if you are still getting an error look at what's being fed into your macro and if you are still stumped let me know.

Nmassarone
8 - Asteroid

ok Perfect thank you for the info ... with that i think i kind of figured what's causing the issue ....

 

the file that I was trying to pull in it looks like 2 of the tabs (that are giving errors) have spaces at the end of the TAB NAME. Even after running a data cleansing after the formula to remove the spaces it still kicks an error. 

 

But if i use another sheet (where none of the tabs have spaces) it seems to work fine. Also i went into the Excel file made a copy, removed the spaces from the TAB NAME and it seemed to work. 

 

Even adding a data cleansing tool inside the MACRO and inside the APP i guess didn't adjust it enough to run it without error so it might just be a process of making sure the tabs do not have any spaces before being uploaded to the APP.

 

Thank you for your help on this appreciate it.

 

 

Nmassarone_0-1675275129735.png

 

Nmassarone_1-1675275215006.png

 

Nmassarone_2-1675275230279.png

 

 

 

apathetichell
20 - Arcturus

O.k. - a few things:

 

1) you don't want to use a data cleansing here - the space is part of the sheet name ie if the sheet name is "my sheet  " - you want it to include those spaces.

2) when using those special characters you'll need to wrap your excel sheet name in quotes. so instead of using your sheet name variable in your formula tool you'd use "`"+[sheetname]+"$`" as your replace term... yes - the entire thing. basically in normal situation file|sheet is fine - but file|`sheet$` is actually more specific...

Labels
Top Solution Authors