I’ve built an Alteryx workflow that:
Takes two input datasets and writes them into one Excel file, each on a separate sheet.
To achieve this:
You use a Render tool to create the dynamic output path (with folders based on Year/Month), since Alteryx Output tools can’t create folders.
Then pass data through a macro that:
Writes the first input to the Excel file using Output Tool 1 with the option: Overwrite File (Remove).
Writes the second input to a new sheet in the same Excel file using Output Tool 2 with the option: Create New Sheet.
The macro uses Block Until Done tools to enforce correct execution order:
Step 1: Take 1st Input and print it through 1st Output anchor.
Step 2: Without deleting the data from 1st Output, it takes data from 2nd Input Anchor
Step 3: Through 2nd output anchor, it appends/adds to the 1st output with the data of 2nd Output within the same excel file.
Despite using Block Until Done, the first Output Data Tool fails, throwing this error:
"Unable to delete Excel file (Make sure the file is writable and not open for writing in another application)"
Solved! Go to Solution.
ok if I understand it correct, your block until done is inside the macro.
If yes, then it will not affect how you are trying to output. The output from macro comes at once, so if you have two output anchors, both of them will output data at same time and your output tools must be trying to access the files at the same time.
Correct me if I understood it wrong, maybe a screenshot will help.
Hi @Gaurav_Dhama_ ,
Take a look, please, and suggest where I'm going wrong.
Block Until Done Macro :
Ok, so you do not need that, it is not that complicated. How I would do is see below.
Use the normal block until done in the first flow of the output, take out the path from the first flow (I am doing that from 3rd anchor of block until done, and grouping on Path in summarization tool, to get a single path. Which i append to my second flow, then use this path as output destination in second output.
So, Thanks for your solution. But the concern is with every scheduled run on 1st of every month, it should create the year/month subfolders as required too.
In this way, I would have the excel file with 2 sheets but only on existing path location. It won't create the path, if it does not exist.
Add the render tool to the first anchor, then first output to second anchor and then second output to third anchor. See below.
Thanks Man!
Seems like, I was just making it more complex for me.