Editor's note: Matt York is a long-time Software Developer extraordinaire at Tableau.
Want to borrow custom shapes from a Tableau Public workbook? That used to be an adventure.
Now there’s the Tableau Custom Shape Extractor
After adding to your bookmarks bar:
Follow these instructions if you need help adding the shapes to Tableau.
A couple vizs to try:
What is this magic? How does it work?
First a little background on how Tableau stores custom shapes.
Tableau saves workbooks as xml in a twb file. When a workbook uses custom shapes, Tableau converts the custom shape image files into text and saves them in the xml.
Heaps of random characters! Those random characters are the shape image data stored as text (base64 encoded).
The good thing about this approach: the twb can be passed around to different computers and the custom shapes go with it. No need to pass around custom shape folders.
The bad thing about this approach: there’s no easy way to reuse the custom shapes in other workbooks unless you have access to the original shape files.
Of course, on Tableau Public you don’t have access to the original shape files.
Over the years enterprising folks used hacks to extract shapes from the Public workbooks. The hacks follow this pattern:
- Download the twbx (a packaged workbook)
- Unzip the twbx (a twbx is just a zip folder with data, twb, and other supporting files)
- Locate the twb in the unzipped folders
- Open the twb as an xml file
- Convert the base64 encoded image data to images
Can’t we write some code that does this for us?
Yes. Yes we can. Yes we did.
Here’s what happens when you click the bookmarklet:
- Your Browser sends the url of the viz to the Shapes Web Server
- The Shapes Web Server requests the twbx from Tableau Public
- Tableau Public delivers the twbx
- The web server extracts the shapes from the twbx, and zips them together
- You download the zipped shapes
Happy vizzing and long live Jigglypuff.