Schedule tableau pdf reports using powershell, tabcmd and windows task scheduler

Though using Tableau UI we can schedule pdf email but it doesn’t give us the flexibility in setting up page layout, scaling, sending email outside of tableau users, etc.,

I used below script to achieve this

Tableau url:
Tableau workbook url: /#/site/sitename1/views/DashboardName_1/ViewName_1
Tableau logon user name: user_1 , password: Password_1
Email address to use for sending email:
Email recipients:;
Tableau tabcmd installed path: E:\Tableau\Command Line Utility\tabcmd.exe
Power shell installation path: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Power shell script path: E:\Tableau\Command Line Utility\ps_tableau_script.ps1
Pdf output location: E:\TableaurRportOutput\DashboardPdf_1
Below is the power shell script.
Smtp server:

Before writing power shell script make sure you are able to send email using command prompt.
You can schedule power script using windows scheduler.
Powershell script: save below code as .ps1 format.


$file = “E:\TableaurRportOutput\DashboardPdf_1″+ “_” + $(get-date -f yyyy-MM-dd) + “.pdf”

#login to tableau and export pdf to a location.
./tabcmd.exe login -s https:// -t sitename1-u user_1 -p Password_1 $ –no-prompt
#-h –no-prompt
#–timeout 5
./tabcmd export ” DashboardName_1/ViewName_1″ –fullpdf –pagelayout landscape –pagesize letter -f $file –no-prompt
./tabcmd logout

#sending email
$FromEmail = “”
[string[]]$ToEmail = @(“”,””)
$smtpserver = ” ”

$Subject=”PDF Dashboard Report”
Good morning,
Please see attached the Dashboard daily report.

send-mailmessage -from (“$FromEmail”) -to ($ToEmail) -subject “$Subject” -Attachment $file -body “$message ” -BodyAsHtml -smtpServer $smtpserver


#failure email
catch [Exception]
Write-Host (“Errorcount $errorcount”)
Write-Host (“Error: {0}” -f $_.Exception.Message)
$errorcount = $errorcount + 1
$message = $_.Exception.Message
if ( $errorcount -eq 1)
send-mailmessage -from (“$FromEmail”) -to ($FromEmail) -subject “$Subject failed” -body “$message” -smtpServer $smtpserver
Start-Sleep -s 600


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s