tabcmd is a powerful tool, allowing a Tableau Server or Tableau user to do many things such as create sites and users via a command line interface (CLI).

Using tabcmd export, users can export views, workbooks, and data to PDF, CSV or PNG.

Downloading and Installing tabcmd

tabcmd is installed by default on Tableau Server, but you can install tabcmd on any host. In this blog we will exclusively be on using tabcmd on Ubuntu 18.04.

You can download any version of tabcmd directly from Tableau's releases page for Tableau Server. In the example below, we use wget to download the tabcmd debian package.

cd /tmp

Change the version above to the version of your Tableau Server/Online.

Next we install tabcmd using dpkg and delete the debian package.

sudo dpkg -i /tmp/tableau-tabcmd-2018-3-3_all.deb
rm /tmp/tableau-tabcmd-2018-3-3_all.deb

You will have to exit and reconnect to your host after installation to get tabcmd in your $PATH. Ensure it's there with which tabcmd. Once installed accept the EULA with: tabcmd version --accepteula

For the export to work you will also need the java runtime installed: sudo apt-get install openjdk-8.jre-headless

Using Tabcmd to Export a Tableau Dashboard as a PDF

To see a help page for tabcmd export with command and global flags use: tabcmd help export.

On our Tableau sever we have an example workbook:

Sample Workbook from Tableau Demo
Sample Workbook from Tableau Demo

In this example we have the view IncomeStatement in the IncomeStatement workbook. It has a URL similar to this: <server_name>/#/views/IncomeStatement/IncomeStatement

The part of the URL we need is "IncomeStatement/IncomeStatement".

NOTE: Even if you're exporting every view in the workbook (using --fullpdf) you will need to include a view in the command. More on that below.

Example Tabcmd Export Command

tabcmd export 'IncomeStatement/IncomeStatement' --fullpdf --pagelayout landscape --pagesize letter -f '/home/ubuntu/year_to_date_full.pdf' -s 'https://<server_name>' -t <site_name> -u '<username>' -p '<password>'

This will create a PDF document with the view in landscape, on a standard letter page size. It will output to a file named: /home/ubuntu/year_to_date_full.pdf.

As our workbook only has one view, --fullpdf will output a one page pdf of our view. We could have also used --pdf to get the same results, however, if the workbook has more than one view --pdf will only export the view given. In that case --fullpdf would have multiple pages, with a different view on each page. Alternatively, You can also output as CSV, and PNG respectively with --csv and --png.

If you are not using a site you can omit  -t <site_name>.

If you're running the export command from your Tableau server you will not need to include server (-s), username (-u), and password (-p) flags.

PDF exported using tabcmd
Final PDF