This week on Twitter Prabakaran asked whether it would be possible to schedule the export of a .CSV or .PDF from Tableau Server.

The answer is a resounding YES!

Getting it setup is also a lot quicker than you imagine as a big chunk of the leg work was done by Glen Robinson at Interworks and he’s made the code available on GitHub.

But let’s start from the top and understand what we are trying to do.

“On a monthly basis, Prabakaran wants Tableau Server to export either a .CSV or a .PDF.”

Tableau provides the Server admin the ability to do this by using tabcdm, I wrote about it here. This example uses PowerShell but you could also do it with Python if that’s your language of choice. The code will use the command function Export, more information here.

The code itself is for Cache Warming, in essence a no-frills way of refreshing those key reports on a regular basis by refreshing them before pushing them out as a .pdf. The use case for Prabakaran is different but the work is basically the same.

Find the code here

On your export .csv you’ll need

  • Type – If you type View here the code will export just the view otherwise it will export the whole workbook
  • Site
  • URLPath
  • File – if you have a preferred destination for it to be stored add the path here.

Once you have the list of views you want to export, is time to change the PS script to work in your environment

It’s worth mentioning that from Tableau 10.0 tabcmd needs to be installed separately from the ordinary server installation. Instructions

When you’ve changed the .csv and the script you can run it using PowerShell, if all went well is time to use the Windows Task Scheduler. TS is an application that comes with all windows machines and you can use to schedule a particular job.

Open TS and create a new task.

Add the path to the script

Create a schedule, in this case on the 1st of every month.

And that’s it, your script should now run and you will have the pdf’s on the 1st of every month.

I hope you have found this useful.

David