6

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.

joshuapoehls
  • 32,695
  • 11
  • 50
  • 61
MrRaymondLee
  • 546
  • 5
  • 12
  • I don't know Interworks tool. They probably work together with Tableau to develop this tool (even for commercial purposes, it's better to have something Tableau approved). But public APIs are not the only way to interact with a software. This is beyond my programming knowledge, but I've seen too many applications that interacted with software or websites that didn't provide an API – Inox May 09 '15 at 14:14

1 Answers1

14

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.

Alex Blakemore
  • 11,301
  • 2
  • 26
  • 49
  • 2
    I would like to add a fifth option to this excellent answer. As Tableau Workbooks are XML files you can use an XML converter to parse the TWB files in bulk into text files or into a database. Once you have the data in text you could use Tableau itself to query and visualise the TWB metadata. https://sonra.io/2017/10/31/convert-xml-metadata-tableau-workbook-text/ – Uli Bethke Nov 02 '17 at 16:54