Skip to main content

I would like to know if I can execute a command line to automatically refresh all extracts in Tableau Desktop where the data source is from a 3rd party's Tableau Server.

 

Every morning I open a desktop workbook from a shared drive, connect to the 3rd party's tableau server and refresh all extracts. The extracts go to a local shared drive (same place as workbook) as hyper files. then I use a Prep flow to join, clean, etc. all the extracts and output to my Tableau Server.

 

I would like to automate the refresh of the extracts so that the final dashboards can be updated and subscriptions of reports needed can be sent on the weekends. Since it's manual process today, weekend data isn't available until Monday when I can manually run the process. I know I can schedule the Prep flow, but the first step of automatically running the extracts from the 3rd Party's server is my issue.

 

Can anyone help me with this?

4 answers
  1. May 26, 2021, 4:53 PM

    @Debbie Andre​ 

    Ok, In this case, you can use the REST API to download the datasources. REST API have some functions devoloped for Python, but like I am old school, I like powershell. I find a module file for Powershell from Glen Robinson who has developed an awesome set of functions for Powershell. To use them, you only need to unzip the contents in a folder, and then use them in powershell.

     

    https://github.com/glenrobinson72/Tableau-Powershell-Scripts/tree/master/REST-API

     

    Next, you open Windows Powershell ISE, I created the following code, with is very easy to use:

     

    #Import the library where you saved it, i.e

    Import-Module "C:\Program Files\WindowsPowerShell\Modules\REST_API_Tableau\Tableau-REST_3_8.psm1" -Verbose

    ⌗For default site

    TS-Signin -server www.yourserver.com -username 'youruser' -password 'yourpassword' -protocol https -siteID ""

    ⌗For other site

    #TS-Signin -server www.yourserver.com -username 'youruser' -password 'yourpassword' -protocol https -siteID "yoursiteid"

    ⌗Download Data sources in zip. These contain the tds, and the hyper

    TS-DownloadDataSource -DatasourceName "Your Data Source 1" -ProjectName "Your Project" -FileName "D:\Where\you\savedatasource1.zip"

    TS-DownloadDataSource -DatasourceName "Your Data Source 2" -ProjectName "Your Project" -FileName "D:\Where\you\savedatasource2.zip"

    TS-DownloadDataSource -DatasourceName "Your Data Source 3" -ProjectName "Your Project" -FileName "D:\Where\you\savedatasource3.zip"

    TS-DownloadDataSource -DatasourceName "Your Data Source 4" -ProjectName "Your Project" -FileName "D:\Where\you\savedatasource4.zip"

    TS-DownloadDataSource -DatasourceName "Your Data Source 5" -ProjectName "Your Project" -FileName "D:\Where\you\savedatasource5.zip"

    #Signout

    TS-SignOut

    #Extract Zip files and overwrite if needed

    Expand-Archive -LiteralPath 'D:\Where\you\savedatasource1.zip' -DestinationPath "D:\Where\you\wantdirectoryextact1" -Force

    Expand-Archive -LiteralPath 'D:\Where\you\savedatasource2.zip' -DestinationPath "D:\Where\you\wanddirectoryextact2" -Force

    Expand-Archive -LiteralPath 'D:\Where\you\savedatasource3.zip' -DestinationPath "D:\Where\you\wantdirectoryextact3" -Force

    Expand-Archive -LiteralPath 'D:\Where\you\savedatasource4.zip' -DestinationPath "D:\Where\you\wantdirectoryextact4" -Force

    Expand-Archive -LiteralPath 'D:\Where\you\savedatasource5.zip' -DestinationPath "D:\Where\you\wantdirectoryextact5" -Force

    After that, in each of the extract path, you will find a data directory, with the hyper file. From there you could use Tableau Prep, or Tableau Hyper API, to upload the final result to your destination server.

     

    If this post resolves the question "Select as Best" or if it assists in resolving the question, please "Upvote". This will help other users find the same answer/resolution and help community keep track of answered questions. Thank you.

     

    Regards,

     

    Diego

0/9000