Knowledge Base

Tabcmd Examples

Product(s): Tableau Server
Version(s): All
Last Modified Date: 21 Nov 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.

Use tabcmd to sign in to Tableau Server

Step 1

Click the Start button, and select All Programs > Accessories. Right-click the 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

  • cd C:\Program Files\Tableau\Tableau Server\<version>\bin

Note: If you installed the 32-bit Tableau Server on a 64-bit operating system, the default path will be C:\Program Files (x86)\Tableau\Tableau Server\<version>bin.

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

  • cd C:\Program Files\Tableau\Tableau Server\<version>\extras\Command Line Utility
  • 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 <username> -p <password>

Notes:

  • Replace <host> and <port> with your specific hostname and port.
  • Replace the <username> and <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.

Use tabcmd to generate a PDF of a Tableau view

To test generating a PDF, type the following command:

tabcmd get "<url-of-view>.pdf" -f "<filename>.pdf"

Notes:

  • Replace <url-of-view> with the view's URL path after it has been published.
  • Ensure to append <url-of-view> 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.

Note: For Tableau Server 8.1. and later, ensure that you do not include the hash tag (#) and number at the end of the URL. 

Use tabcmd to send email messages

While the tabcmd by itself cannot send email messages, if you are using Tableau Server 8.0 and later, 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"

Note: For Tableau Server 8.1. and later, ensure that you do not include the hash tag (#) and number at the end of the URL. 

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 email with an embedded image

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"

Note: For Tableau Server 8.1. and later, ensure that you do not include the hash tag (#) and number at the end of the URL. 

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:

<html>

<head><title>Email Alert</title></head>

<body><img src="progressReport.png".</body>

</html>
 

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