One of the things I often read about on the Alteryx forums is people asking how to publish to Tableau Server from Alteryx. Previously I wrote a post about publishing to Tableau Server from Alteryx using the Events functionality. A downside of this is the timing of the publish to Tableau – it either happens before or after the workflow has run. To publish to Tableau server from within an Alteryx module the Run Command tool can be used, meaning publishing from Alteryx to Tableau Server can happen from anywhere within the worklow.
The Alteryx Run Command tool allows the running of any command line script during a workflow. Tableau’s tabcmd enables publishing to Tableau Server direct from the command line. Therefore in Alteryx we can write a command line script calling tabcmd and execute that script using the Run Command tool, meaning we can publish directly to Tableau Server from Alteryx in a workflow.
Follow these steps to for a simple example:
1. Add a Text Input tool and enter the filepath of the Tableau Data Extract file.
2. Add a Formula tool and create an Output Field called “cmd” with your script to run in the Command prompt. It’s recommended to create in Notepad initially and test it in the Command prompt to ensure it works as expected.
3. The structure of the Command prompt script should be:
a. TabCmd location
b. Command to run on TabCmd – ‘publish’ in this example
c. Tde file to publish to Tableau Server
d. Options/arguments required to publish using TabCmd. http://onlinehelp.tableau.com/current/server/en-us/tabcmd_cmd.htm
4. Use a Select tool and select the Output Field just created. Only the Command script should be loaded into the Run Command.
5. Add a Run Command tool:
a. In the Write Source Output section identify where the batch file should be saved. In the examples I use the Alteryx temp directory. Set it to be a csv File Format, no delimiter, no field names and no quoted output fields
b. Call the bat file just created in the Run External Program – Command area
The final workflow to publish to Tableau Server from Alteryx is as follows: