Using the Alteryx Run Command Tool


Using the Alteryx Run Command Tool

The Run Command tool allows you to extend the capabilities of Alteryx by running external commands the same as you would from the command line. Need to run a Python script? Gzip a file? Utilize tabcmd? All of this can be done using the Run Command tool.

I’m going to walk through the configuration for two specific examples: Moving a file created with Alteryx to another location and running a Python script. These will show what the Run Command tool does and how to use it to call programs from Alteryx (you’ll find the files used in this example attached at the bottom of the post). First, understand that Run Command has three major steps, two of which are optional:

  1. Write Source (Optional): Take the data from the Alteryx data stream and write it to a file or database table. Same as Output tool.Alteryx: Write Source
  2. Run External Program (Not Optional): Run a command.Alteryx: Run External Program  
  3. Read Results (Optional): Read a file back into the Alteryx data stream. Same as Input tool.                                                          Alteryx: Read Results

To follow along with the second example, you will need to install Python 2.7

Copy a File Created by Alteryx

To copy a file from one location to another, you can use the xcopy command from the Windows command line.

The /Y option prevents Windows from asking permission to overwrite a file.

xcopy from_herewrite-to-file.csv to_here /Y

Command Prompt

To run the same command from Alteryx:

Alteryx: Run Command

Here, Alteryx writes the data in the data stream to the file write-to-file.csv listed in Write Source, just like an Output tool. The file is located in the folder from_here. We will copy the CSV file to the folder to_here using the xcopy command. There is no connection to the Run Command output, so Read Results is not required and no data will be output.

Run a Python Script

First, you need to download and install Python 2.7:

To run a Python script with options, you will need use the Python command in the directory where you installed Python. For me that is C:Python27

Command Prompt

If you look in you can see that it will read the CSV file alteryx-to-script.csv, add an ID column that is named according to the option -f and then write to the CSV script-to-alteryx.csv.

To run the same command from Alteryx:

Alteryx: Run Command

Here, Alteryx writes the data stream to a file alteryx-to-script.csv the same as an Output tool. Then, which is configured to read the file output from Alteryx, is run and the ID column is added. For this run, the ID column will be named recordID because of the option -f recordID. The script then writes script-to-alteryx.csv which is read into Alteryx from Read Results just like an Input tool. Write Source and Read Results are necessary when the command in Run External Program needs to access the data in Alteryx. Note also that in the Command box, if you have installed Python in a different location, you will need to adjust the call from C:Python27python.exe to your installation location.

You can also edit your system PATH variable to include the path to Python so that you only need to type the command and not the full path.

The Configuration Options

Write Source

If the Run Command tool has an input connection the data from that connection will be written to the file or database specified. This works the same as an Output tool. The expectation is that the data written will be read by the external command.

Alterx: Write Source


The name and full path (unless your system path variable is set) for the command that you want to run. In these examples, I am using xcopy and Python but yours could be anything (e.g. curl, Rscript, tabadmin, etc.)


Any arguments including options, file names, etc. that are specific to the command you need to run. In the second example, I am running the command Python with two options: the name of the script to run ( and the name of the ID column (-f recordID).

Working Directory

The default working directory for Run Command is the location where the Alteryx module is saved. This is equivalent to using the change directory (cd) command. You can specify a different working directory if necessary. Note that the working directory change does not apply to files listed in Write Source or Read Results. It only applies to options in the Run External Program box.

Read Results

The file or database table specified here will be read by Alteryx upon successful completion of the command. This is equivalent to the Input tool. The expectation is that the data manipulated by the external command can now be used in Alteryx for further processing. This step is optional and if no table or file is supplied Alteryx will simply run the command and no data will be read into the data stream.

Run Silent Minimized

You may notice that when you run a module that contains the Run Command tool, the command prompt window will briefly pop up, print output and disappear. Run Minimized will keep the command prompt minimized when the module is run. Run Silent will prevent the command prompt window from opening at all.

More About the Author

Michael Treadwell

Data Lead
Introducing the Snowflake Data Cloud: Data Science When you think of data science (for the purposes of this blog, this will encompass all machine learning and AI activities), you may ...
The Migratory Patterns of the Common Alteryx Workflow Prior to Alteryx Server version 2018.4, migrating workflows was a three-step process: Deny the problem exists Procrastinate Acquiesce ...

See more from this author →

Subscribe to our newsletter

  • I understand that InterWorks will use the data provided for the purpose of communication and the administration my request. InterWorks will never disclose or sell any personal data except where required to do so by law. Finally, I understand that future communications related topics and events may be sent from InterWorks, but I can opt-out at any time.
  • This field is for validation purposes and should be left unchanged.

InterWorks uses cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to this policy. Review Policy OK


Interworks GmbH
Ratinger Straße 9
40213 Düsseldorf
Geschäftsführer: Mel Stephenson

Telefon: +49 (0)211 5408 5301

Amtsgericht Düsseldorf HRB 79752
UstldNr: DE 313 353 072