The tabadmin command line utility allows us to do administrative tasks such as start, stop, backup and install the Tableau Server, but you can only run these commands on a Tableau Server itself. The tabcmd command line utility on the other hand, is more about manipulating the content on Tableau Server. This can include things like creating a project, adding a user, publish a workbook or refreshing an extract. Moreover, we can type these commands into a script which we can then schedule to automate many of these processes. Furthermore, this command line client is portable which means that we can still connect with the server, but it’s saved and ran locally on our computers.
One very common application of tabcmd is to automate the downloading of pdfs of certain dashboards for mass distribution to all the staff by email. This is called ‘report bursting’ and serves to provide staff with information from a worksheet without having to fork out for a separate Tableau Server licence for each member of the company that wants to consume that content.
Another application might be to create a project and automatically assign group or user permissions for that project. Or alternatively, it might be to specify with more precision the time and date for which to refresh an extract on the server.
To use tabcmd, first download it from the download page tableau.com/esdalt and look for TableauServerTabcmd-64bit-10-2-0.exe (52 MB).Open the command prompt and move to the folder where you installed tabcmd. The default command would be,
cd "C:\Program Files\Tableau\Tableau Server\10.2\extras\Command Line Utility"
We can check whether our tabcmd is in the folder by typing,
Which gives us,
15/03/2017 11:36 <DIR> . 15/03/2017 11:36 <DIR> .. 23/02/2017 20:45 5,916,755 app-tabcmd-latest-jar.jar 23/02/2017 19:28 94,614 COPYRIGHTS.rtf 23/02/2017 19:25 608,080 msvcp100.dll 23/02/2017 20:46 660,128 msvcp120.dll 23/02/2017 19:25 829,264 msvcr100.dll 23/02/2017 20:46 963,232 msvcr120.dll 23/02/2017 20:46 802,640 msvcr80.dll 23/02/2017 19:21 320 NOTICES.txt 23/02/2017 19:28 197,222 server.ico 23/02/2017 20:45 237,056 tabcmd.exe 10 File(s) 10,309,311 bytes 2 Dir(s) 419,203,854,336 bytes free
And sure enough, tabcmd.exe is in the list.
Because, unlike tabadmin, we are likely using this tool on our own computers, the first thing we need to do is login to our server. We can do this with the following command,
tabcmd login -s http://220.127.116.11 -u username -p Password123
where the -s http://18.104.22.168 should be your unique IP address of the server (not these exact numbers!) and similarly -u username and -p Password123 specify your unique username and password for Tableau Server. If done correctly we should get ‘success’,
===== Creating new session ===== Server: http://22.214.171.124 ===== Username: username ===== Connecting to the server... ===== Signing in... ===== Succeeded
Now we can start using some tabcmd commands. This is a good opportunity to check the Tableau help page here, which has the full list of commands and explains all the additional parameters.
Here is a scenario likely to be encountered at work that uses a series of commands using tabcmd:
First you want to keep track of everybody’s progress in the staff football team, so naturally you decide to create a new project,
tabcmd createproject -n "Work Football Team" -d "Tracks the goals scored by players in the work football team, Tableau FC"
which creates a new project called Work Football Team with a description to match. Because no site was specified, this project will be created in the ‘Default’ Site.
Then we might want to publish a naked data extract, goals.tde which records the number of goals for each player in the office. Such a command would look like,
tabcmd publish "C:\Users\User1\Critical Tableau Workbooks\goals.tde" –--project “Work Football Team” -n "Number of Goals” --db-username "user1" --db-password "Password123"
We have now published goals.tde to the Work Football Team project but now it is called Number of Goals.
Your mate John becomes aware of this datasource sitting on the server unused and requests that you make him a user and then grant him access. You reluctantly accept, create a csv file with John’s name inside and type,
tabcmd createusers “user.csv” –-role “Publisher” tabcmd addusers “Work Football Team User Group” –-users “user.csv”
which uses user.csv file containing John’s username and adds him to a group which has permissions to view, interact and publish content to the Work Football Team” project. John is delighted with this. Not only can he now gain access to the datasource, but he can also publish content (due to his site role privileges). He decides to upload his own viz using the datasource,
tabcmd publish "C:\Users\John\Tableau Workbooks\GoalsPerGame.twb" --project “Work Football Team” -n "Goals per Game” --db-username "John" --db-password "Password123"
But now several weeks have passed and many more goals have been scored, so we want to update this data extract. We can do so by typing,
tabcmd refreshextracts -–project “Work Football Team” –datasource “Number of Goals”
But now the manager has found out and he’s a rugby fan. He orders you to delete the project.
You rather like John’s viz (and you’re sitting pretty at the top of the goals per game chart on Sheet1, so first you export the viz as a pdf to email to all your colleagues,
tabcmd export –-project “Work Football Team” “Goals per Game/Sheet1” –-pdf
Finally, you remove the project,
tabcmd deleteproject “Work Football Team”
and close the command prompt.