-
1. Re: Automated dashboard image
K P Feb 17, 2016 8:46 AM (in response to K P)2 of 2 people found this helpfulGenerating pdf will also work.
Thanks
-
2. Re: Automated dashboard image
Tyler Garrett Jul 18, 2017 6:29 PM (in response to K P)2 of 2 people found this helpfulYes, we have a few scripts for doing this task. Automated version is posted below in PowerShell.
Source code posted below and also we explain it in this blog post.
How to do Tableau Server Automated Dashboard Image - A Solution here
Thanks
Tyler G.
Dev3lop.com
-
3. Re: Automated dashboard image
Derrick Austin Feb 17, 2016 9:06 AM (in response to Tyler Garrett)4 of 4 people found this helpfulHey Kush,
You can do this with tabcmd's export function. Here is the documentation: tabcmd Commands
After installing tabcmd, it is basically the following, on a scheduled basis:
tabcmd login -s http://sales-server -t Sales -u administrator -p aPasswordHere
tabcmd export "Finance/InvestmentGrowth" --png
- Derrick
-
4. Re: Automated dashboard image
Tyler Garrett Jul 18, 2017 6:27 PM (in response to K P)5 of 5 people found this helpfulDerricks works great for quick and easy manual means of doing it. I would recommend taking that path unless you're running bigger jobs.
#_______________________________Start here
# PNG EXPORT Script
# A powershell script to pull down pngs of Tableau "views"
#
# Created By - Tyler Garrett
#
#
# || NOTES ||
# Create Directory C:\POSH\PNGExport
# This directory will store all content
# Script expects Tableau Bin directory to be set in Environment Variable Path
#_______________________________
#________________________________
# Set variables
#________________________________
$TS = "http://localhost" #Server
$username = "admin" #tableau server account
$pass = "admin" #tableau server password
$pgUSR = "readonly" #readonly account password must be setup beforehand
$pgPW = "admin" #postgres password
$SiteF = "BeepTest" #site you're pulling PNGs from
$ProjectF = "ProjectTest" #project you're pulling PNGs from
#_______________________________
cd C:\POSH\PNGExport
#_______________________________
#--------------=====================]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
#¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
# |
# Query postgresql and build CSV with workbook URL (3 steps)|
# |
#¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
# |
# 1.Connection info |
# |
#¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
Set-Location "C:\POSH\PNGExport"
function Get-Stuff
{
[CmdletBinding()]
param (
[string]$connectionString,
[string]$query
)
Write-Verbose 'Getting Tableau Server Extract'
$connection = New-Object -TypeName System.Data.Odbc.OdbcConnection
$connection.ConnectionString = $connectionString
$command = $connection.CreateCommand()
$command.CommandText = $query
$adapter = New-Object System.Data.Odbc.OdbcDataAdapter $command
$dataset = New-Object -TypeName System.Data.DataSet
$adapter.Fill($dataset)
$dataset.Tables[0]
}
#¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
# |
# 2.Query PostgreSQL |
# |
#¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
$connectionString = 'Driver={PostgreSQL ANSI(x64)};Server=localhost; Port=8060; Database=workgroup; Uid='+$pgUSR+'; Pwd='+$pgPW+';'
$query = @"
SELECT
v.view_url
FROM _views v
INNER JOIN _workbooks w on (w.id=v.workbook_id)
INNER JOIN _sites s on (s.id = v.site_id)
WHERE s.name = '$SiteF'
and w.project_name = '$ProjectF'
"@
#¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
# |
# 3.Build CSV to be used for tabcmd from the above query|
# |
#¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
Get-Stuff -connectionString $connectionString -query $query | `
Select-Object -Skip 1 -Property view_url | `
Export-Csv -Path "C:\POSH\PNGExport\Reports.csv" -NoTypeInformation -Delimiter ";"
#--------------=====================]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
#_________________________________
# Loop through CSV from above and export those views as PNG files
# -replace is used in the loop to save the file name with out a "/"
# because this value isn't allowed in a file naming convention
# error output will be generated in the folder
#_________________________________
tabcmd login -s $TS -u $username -p $pass -t $SiteF
ForEach ($wb in @(Import-Csv -Path C:\POSH\PNGExport\Reports.csv | select -expand view_url) )
{
Try
{
$newwb = $wb -replace "/", "_"
tabcmd export $wb --png -f $newwb 2>> C:\POSH\PNGExport\TabCmdGetWbErr.txt
}
Catch
{
Write-Error -Message “Error occured: $_”
}
}
#_________________________________
# Convert PNG to BMP - helps people who are moving these photos into Powerpoint
# Comment the Dir *.png.... line out of the script if you want to keep them as PNG files
#_________________________________
Dir *.png | rename-item -newname { $_.name -replace '\.png$','.bmp' }
tabcmd logout
#_______________________________End here
Cheers,
Tyler Garrett
founder
Dev3lop
-
5. Re: Automated dashboard image
Kenneth McBride Feb 17, 2016 10:08 AM (in response to Tyler Garrett)I'm curious about this line Tyler:
Dir *.png | rename-item -newname { $_.name -replace '\.png$','.bmp' }
What's the point of renaming the .png to a .bmp since it isn't actually converting the image file?
-
6. Re: Automated dashboard image
K P Feb 17, 2016 10:46 AM (in response to K P)1 of 1 people found this helpfulHello All,
Thank you so much for responding so fast.
For me just creating the BAT file and run it with windows task scheduler did the trick. thank you DERRICK AUSTIN.
used this script---
"C:\Program Files\Tableau\Tableau Server\9.2\bin\tabcmd.exe" login -s http://servername/ -u username-p password
"C:\Program Files\Tableau\Tableau Server\9.2\bin\tabcmd.exe" get "/views/workbook/worksheet.pdf" -f "C:\Users\TEST.pdf"
TYLER GARRETT, I am going to note your answer for future. currently requirement is for only one dashboard.
it is very informative and helpfull.
Thank you all once again. I love this forum.