Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Exporting to excel, one table to multiple workbooks

bkoons
7 - Meteor

I am trying to create a batch macro that will output results to multiple files. I have cash flows (A,B,C) that get output to excel workbooks (X,Y,Z) in this way:

 

X needs A & B

Y needs B

Z needs B & C

 

I have the first input into the batch macro that lists the file path and tab names for X,Y,Z and I have a second input table that lists the cash flows concurrently. There is a cash flow (CF) for each mapping, meaning cash flow B is listed in the table three times, each with a field listing the path and tab of the destination (dp):

 

CF-A (dp-X, tab A)

CF-B (dp-X, tab B)

CF-B (dp-Y, tab B)

CF-B (dp-Z, tab B)

CF-C (dp-Z, tab C)

 

 

The batch macro is simply an output data tool set to change the entire path based on the path and tab being passed by the first input.

 

What is happening is each filepath and tab listed in the first input is being populated with the entire cash flow table, not just the ones specific to that file. So workbook X, tab A has cash flows:

CF-A (dp-X, tab A)

CF-B (dp-X, tab B)

CF-B (dp-Y, tab B)

CF-B (dp-Z, tab B)

CF-C (dp-Z, tab C)

 

On top of that, the macro is writing to the same file&tab several times.

 

I'm hoping this description is enough for someone to help, without me creating a dummy example. Thanks in advance for any help you can offer!

2 REPLIES 2
Philip
12 - Quasar

Sorry if I've misunderstood the problem, but I don't think you really need a macro to accomplish this. I've attached a short workflow that uses a filter and output tool to write the correct data to the correct file with the new tab id attached. Please let me know if this doesn't solve your problem.

 

WriteToTabs.png

bkoons
7 - Meteor

Thanks for the reply Philip. I was able to use the output tool functionality without the batch macro to solve the issue. My example provided a set number of splits, but in reality that number can vary so I wasn't able to setup a fixed number of filters without having to manipulate the workflow each time.

Labels
Top Solution Authors