Using Tabcmd


RELATED ARTICLES

Product(s):  Tableau Server
Version(s):  All
Last Modified Date:  21 Mar 2013
This article describes some tasks you can perform using the Tableau Server command line tool (tabcmd), including logging in to Tableau Server, and generating PDFs of Tableau Server views. Also, if you use tabcmd with your own custom scripting, this article describes one way you can generate email messages. To install tabcmd, follow the steps described in the Installing Tabcmd article. For a complete list of tabcmd tasks that you can perform, refer to the tabcmd Commands topic in the Server Online Help.


Note: Do not try to copy and paste entire sections or commands in this article without modifying them, because they are examples and unlikely to fit your particular situation exactly.

Log in to Tableau Server using tabcmd

Step 1

Click the Start button, and select All Programs > Accessories. Right-click Command Prompt and select Run as administrator.

Step 2

Type one of the commands below, depending on where the tabcmd utility is running from.

If you are running the tabcmd utility from the same machine as Server:

  • On a 32-bit machine: cd C:\Program Files\Tableau\Tableau Server\[version]\bin
  • On a 64-bit machine: cd C:\Program Files (x86)\Tableau\Tableau Server\[version]\bin

If you are running the tabcmd utility on a separate machine from Server:

  • On a 32-bit machine: cd C:\Program Files\Tableau\Tableau Server\[version]\extras\Command Line Utility
  • On a 64-bit machine: cd C:\Program Files (x86)\Tableau\Tableau Server\[version]\extras\Command Line Utility
Note: Replace [version] with the version of Tableau Server you are running. 

Step 3

Type the following command:

tabcmd login -s http://host:port -u admin -p password

Notes:

  • Replace http://host:port with your specific hostname and port. 
  • Replace the admin username and password password with a valid Tableau server username and password for someone who has publishing rights.

If the command is executed successfully, you will see something similar to the following example:

C:\tli>tabcmd login -s http://tableauserver:80 -u admin -p password
===== Creating new session
===== Server: http://tableauserver:80
===== Username: admin
===== Connecting to server...
===== Logging in...
===== Login Succeeded.

Generate a PDF of a Tableau view

To test generating a PDF, type the following command:

tabcmd get "[URLofView].pdf" -f "[FileName].pdf"

Notes:

  • Replace [URLofView] with the view's URL path after it has been published.
  • Ensure to append[URLofView] with .pdf, like in the example above.
  • Replace [FileName] with the name you want to give to the generated PDF file.
For example, the tabcmd command can look like this:

tabcmd get "/views/Wow/SummaryReports.pdf" -f "progressReport.pdf"
 

If the PDF generates successfully, tabcmd places the PDF file "progressReport.pdf" in the current working directory.

Use tabcmd to send email messages

While the tabcmd by itself cannot send email messages, if you are using Tableau Server 8.0 and alter, you can configure email alerts if there is a system failure or subscriptions that allow users to subscribe to their favorite views. For more information about these features, refer to the Email Alerts/Subscriptions topic in the Server Online Help. Alternatively, you can easily add this functionality through scripting. Many applications and scripting languages are available, and you can combine the printing automation of tabcmd with practically any other logic. Two examples illustrate this capability.

This example uses email shareware called febootimail.exe (search the Web for "febootimail" for more information). This program allows full control over aspects of the e-mail generation.

Here is an example that sends as an e-mail attachment the PDF progress report you generated in the last example.

tabcmd login -s http://tableauserver:80 -u admin -p admin
tabcmd get "/views/Wow/SummaryReports.pdf" -f "progressReport.pdf"
febootimail.exe -SMTP yourSMTPhost.yourcompany.com -TO "recipient1@yourcompany.com; recipient2@yourcompany.com;recipient3@yourcompany.com" -FROM sender@yourcompany.com -SUBJECT "Generated Tableau View - Tableau Server Automated Alert System (TSAAS)" -ATTACH " C:\Program Files\Tableau\Tableau Command Line\progressReport.pdf" -BODY"this is the text of the body"

If you install febootimail and review its help files, you can note the following:

  • Instead of typing the e-mail addresses of recipients using the TO tag, you can refer to a file.
  • Instead of typing the e-mail body using the BODY tag, you can specify an HTMLFILE tag.
  • You can attach multiple files.

These features provide control over the Tableau generation and e-mail process. Many other applications and scripting languages also have this type of support.

Send formatted e-mail with a Tableau picture embedded

Tabcmd can generate PNG files, and febootimail.exe can send HTML e-mail. The febootimail help says that the HTML file must be in the same directory as febootimail.

Here is an example script:

tabcmd login -s http://tableauserver:80 -u admin -p admin
tabcmd get "/views/Wow/SummaryReports.png" -f "progressReport.png"
febootimail.exe -SMTP yourSMTPhost.yourcompany.com -TO "recipient1@yourcompany.com; recipient2@yourcompany.com;recipient3@yourcompany.com" -FROM sender@yourcompany.com -SUBJECT "Generated Tableau View - Tableau Server Automated Alert System (TSAAS)" - -HTMLFILE "emailbody.html"

Notice that the BODY tag has been replaced by an HTMLFILE tag. Because tabcmd can auto-generate a PNG image, you can reference that image in the body of an HTML email template. Here is a simple version of this HTML file:

Alternate Search Terms: tabcmd, installing tabcmd, using tabcmd, command line utility, generate pdf, generate email, subscription, email, favorite view

Did this article resolve the issue?


ATTACHMENTS





Search Knowledge Base