This post explains how to read and write an excel file (or any other file) multiple times in the same Alteryx workflow using Control Containers.
How to Achieve it:
Using Control Container, a new tool which was introduced with the Alteryx 2023.1 version, it is easily possible to multiple read and multiple write for any file in the same workflow.
To begin with let us consider a ordinary workflow which outputs an excel file in the first step and tries to read this file for further downstream processing as shown below. When this workflow is executed for the first time, the “Output” file is successfully created in first step but it can’t be read yet by an input tool of second step.
Similarly on the following executions, the second step’s input tool has gained access to the “Output” file which is being read thus prohibiting its write access in the step 1.
The Control Container tool comes very handy in such a situation. By enclosing these two steps in two separate control containers, and then connecting those containers, it is possible to execute the work flow smoothly. Thus multiple reads / writes for the same file can be easily achieved by adding such control containers and connecting them as shown below.
One consideration for the order of execution is that, Control Containers will execute tools inside it only after receiving all records via its Control Input anchor. Thus the order of execution can be adjusted by connecting these containers one after the other as required.
Control container comes handy when the same file needs to be used for multiple reads / writes in a workflow.