Publishing To Tableau Server with PowerShell


Hi All!

Time for a useful little piece of PowerShell code for publishing your Tableau workbooks or data sets to a server. Tabcmd won’t connect to Tableau in PowerShell unless you provide a password in the script, so I’ve added in a little script courtesy of Jamie Thompson (which you can find here). This script will allow you to specify the folder containing the files you want to upload to your server, along with the site name and project and then it will publish them for you. You can change the -Include section to uploade other kinds of files to your Tableau server.

$username = Read-host "Please Enter Username: "
$response = Read-host "Please Enter Password: " -AsSecureString
$password = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($response))

$ReleaseFolder = "C:\Users\jim\Release"
$SiteName = "Samples"
$ProjectName = "default"
$publishFile = ""

ForEach($item in (Get-ChildItem -Path ($ReleaseFolder + "\*") -File -Include *.tdsx))

   $publishFile = """$item"""
   tabcmd publish $publishFile -t $SiteName -r $ProjectName -u $username -p $password

I hope you find it as useful as I have!


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 )

Google+ photo

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

Twitter picture

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

Facebook photo

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


Connecting to %s