Using Scripts to Refresh On-Premises Data Sources

Version 15

    Updated 1/20/17: Changed the file type from BAT to CMD for Step 2, as this allows the refresh to execute even when logged off of the machine.


    In addition to the Online Data Sync Client, you can automate extract refreshes using the Tableau Data Extract Command-Line Utility. This is a utility that comes with Tableau Desktop, through which you can refresh published data sources or append data to them from a file.


    For added control and flexibility, you can use the Windows Task Scheduler, in combination with the Tableau Data Extract Command-Line Utility. For example, you can configure a task to occur once per day, week, or month, or after a specific system event.


    To Automate Refresh Tasks Using Windows Task Scheduler


    Step 1. Create a Config Txt File Containing the Following Parameters Needed to Refresh the Published Extract:




    project=New Animations




    Note: If refreshing a local flat file, replace the "source" options with "original-file" and then specify the path to the file. Use UNC format if the file is on a network share. For example, original-file \\server\path\filename.csv.


    For additional options and details, please see Automate Extract Refresh Tasks.


    Step 2. Create A .cmd File Containing the the Following:

    @echo on

    cd "c:\program files\tableau\tableau 10.1\bin>"

    tableau refreshextract --config-file "C:\Users\username\Desktop\config.txt"


    Note: Be sure to update the file path to the config file created in Step 1.


    Step 3. Using Windows Task Scheduler, Create a New Task to Execute the Refresh Command on a Schedule.

    1. Open Windows Task Scheduler (taskschd.msc)
    2. Select Task Scheduler Library, and in the Actions Pane select Create Task.
    3. Enter the desired name and select Run whether user is logged on or not.
    4. Select the Triggers tab, and select New to configure the desired refresh schedule.
    5. Select the Actions tab, and select Browse to locate the .cmd file (from Step 2) to execute the refresh task.
    6. (Optional) Configure any additional options on the Settings tab.
    7. Select OK when finished.



    Note: The Task Scheduler service uses the Component Object Model (COM) service, the Windows Event Log service, and the Remote Procedure Call (RPC) service; all of these services must be started for the Task Scheduler service to run correctly.


    For additional details and resources, please see the following articles: