Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What Tableau API does InterWorks uses in their Workbook SDK?

Tags:

tableau-api

InterWorks has a Workbook SDK as part of its Power Tools for Tableau product. Does anyone know how they are able to do this? The SDK can access a workbook without Tableau Server so I don't think it's the JavaScript or REST API.

like image 854
MrRaymondLee Avatar asked May 09 '15 04:05

MrRaymondLee


1 Answers

A Tableau workbook (.twb) file is in XML format. The structure may change between versions, but is relatively straight forward to follow. Most Tableau file formats are also XML. The formats ending in an x (like .twbx) are zipped directories that contain the XML file along with other files.

This means it is not too tough to read information from these XML files, or even modify them. I've edited them by hand in rare cases. Usually there is a better choice than hacking the XML internals, but you can. Just backup your file first, and don't expect Tableau support to help you if it leads to strange behavior on your workbook.

In addition to the Interworks SDK (which is a COTS product), Chris Gerrard published a free Ruby library for accessing Tableau workbooks https://rubygems.org/gems/twb (or gem install twb) and released the source on github https://github.com/ChrisGerrard/TWB, along with a few (but not all of) the scripts he's written that use the twb classes https://github.com/ChrisGerrard/TableauToolsRuby.

Chris gives some useful examples and scripts on his blog Tableau Friction, including this clever article on automatically documenting the relationships among calculated fields http://tableaufriction.blogspot.com/2015/02/more-calculated-field-analysis-fields.html

Using twb, you can write simple Ruby scripts easily to look at workbook structure. Since Tableau can change the format when they release new versions of the software, using the SDK or twb Ruby gem could isolate your scripts from changes to the format.

Tableau has also released a Document API that supports a modest number common changes to workbooks - so you can write a script to say, update the connection string on a set of workbooks.

So you have at least four choices:

  1. Use Interworks SDK and tools that come with support, documentation and a price tag.
  2. Use the free open source twb library, and either reuse existing Ruby scripts or develop the ones you need. And hopefully contribute the source if you extend.
  3. Roll your own XML parsing scripts.
  4. Use the Tableau Document API if it supports your use case. https://github.com/tableau/document-api-python

In all cases, do backups and be prepared for some adjustments when Tableau releases a major or minor version update. Patch releases are pretty safe.

like image 100
Alex Blakemore Avatar answered Oct 03 '22 03:10

Alex Blakemore