Hello Alteryx Community,
I'm trying to create a macro that takes a folder path and a file name as inputs and returns the specific file based on these keys.
For example:
When I input "fileA" along with the folder path, I want the macro to return the data from fileA. Below is the sample data for fileA:
Id Length Width Height Weight
box1 | 10 | 20 | 30 | 50 |
box2 | 10 | 30 | 20 | 40 |
box3 | 20 | 15 | 15 | 10 |
I've explored tools like the Directory and Dynamic Input, but I'm unsure how to configure them to achieve this functionality. I've also attached an example files folder for reference.
Any guidance or suggestions on how to approach this would be greatly appreciated!
Thank you in advance for your help!
Solved! Go to Solution.
@hcho sample attached
Thank you for sharing the sample workflow! I'm trying to follow along, but I'm still confused. It seems like the macro can take the folder path but not the file name directly. Does this mean the only way to specify a different file is by entering the macro and manually changing the file name? Or is there a way to dynamically select the file name as well?
I appreciate your help, @binuacs!
@hcho Are you looking for an interface tool where the user can give the file name to the macro?
No, I am looking for a file name fed into macro in a table formed like this so that this can call each file iteratively later on:
fileName
fileA |
@hcho I added a text input tool where you can add the file name, then the filter tool filter out the file path from the directory tool output and give you the output from the macro
@hcho - when you say "return the data" if this is an excel file - you must supply the sheet. the process of mapping a folder to a filename is straight forward. the part where you say "and then choose this sheet" requires a rule structure. you must create that rule structure and explain it.