<< Back

Backing up Workbooks and Datasources from Tableau Server

Use Case

We often see areas of Tableau Server set aside for dashboards which are ideas in development or one off publications to share some specific thoughts. The “data playground”, the “in development”, or even the “dump”. If you’re using Tableau Server, you’ll likely have one of these. They start off with good intentions, but they grow and become something of a headache to manage. A good housekeeping policy is in order. Whilst deleting items is a straight forward multi-click of those items and a delete, if you’re the conscientious type who’d like a backup before you hit delete, it’s a little more convoluted. If you want to download them beforehand, its single-click, download, de-select, re-select, download etc… it can take a while.

You can usually rely on the server admins to have backed up the Tableau Server (a great script here) but you do always need a spare server to restore any backup onto, or alternatively a little bit of luck in unzipping the backup file and tracking down what you need.

An alternative is to script the backup of certain objects so you have the files a little more readily available if they’re needed. And that’s what this blog is all about.

Concepts

We’re going to utilise PowerShell for scripting capability. I’m relatively new to PowerShell, and this has been a good opportunity for me to learn the basics, so by all means feedback on what I’ve done. Depending on your environment you may need to run this script with admin privileges and/or set the execution policy for your session.

Tabcmd will be used to get the various pieces of content from the server. It assumes you’ll be connecting as an account which has appropriate access to your Tableau Server. If you’re running this script away from the server you’ll also need to ensure you’ve got a copy of tabcmd.exe installed locally. Ideally you’ll have grabbed this from your server so you ensure you have the appropriate version (link).

Tableau Server XML information files are generated by the server to allow easy access to information regarding the various objects published there. We’ll be iterating over the sites, workbooks and datasources XML files in order to drive tabcmd to do what we want.

The Script Basics

You’ll need to configure the script for your environment, which you can do by amending the variables at the top.

  • Location of tabcmd file
  • Where to store your output
  • Tableau Server URL
  • Tableau Server Username and Password for the connection (if you need extra security, consider obfuscation for the password)
  • Site name (single named site or all)
  • Project name (single named project or all)
  • Data sources with extracted data or not

Depending upon number of items and their size, this script can take a while to execute. I’d hope its kinda obvious, but what I would say, is exercise some caution if you are running this over a large part of your server on your production server at your busiest time.

 

The Script Itself

To keep things simple I’m just going to include a link to the script here. I’ve added an extra .txt suffix, if you remove that you will have the ps1 PowerShell script and can edit it in the editor of your choice.

 

 

 

Mike Lowe

Oxford, UK

2 thoughts on “Backing up Workbooks and Datasources from Tableau Server

  1. Hi Mike – Great post!

    One thing I noticed when using this – I got some errors trying to run it on $sitename=’all’, so I opted to run it one site at a time within my tableau server. In doing so, the backup path fails after the first site is run because it is scripted to create a directory with the current date each time. (After the first site is run, this directory already exists). There are a few ways to adjust this – I just chose to replace the date element on line 33 with ($sitename) so it will create a new directory with the name of the site for which I’m running the current script. These are of course unique within my tableau server, so it seems to run cleanly now. Hope that helps if anyone is seeing a similar issue.

Leave a Reply

Your email address will not be published. Required fields are marked *