Ever got a Tableau workbook with shapes you want to re-use, but weren’t able to because you didn’t have the original files?

You can extract the files from the workbook! Either by hand opening the source code, or using my small Python script.
Custom Shapes in Tableau
In Tableau, you can use the Shape Mark property to represent data with different shapes. You can choose from Tableau’s default shapes or add Custom Shapes. Tableau includes built-in Custom Shape palettes (arrows, currency symbols, etc.), which you can find in the Shapes folder of your Tableau Repository.
You can also add your own Custom Shapes by creating a new folder in the Shapes directory and placing image files (.png, .gif, .jpg, .bmp, or .tiff – not .svg) inside. These shapes will then appear in the Edit Shape dialog for use in your visualizations. Tableau embeds Custom Shapes in the .twb file, ensuring the workbook works on any computer—even if the original shape files are missing.
Missing Shapes
Now, imagine opening a workbook with Custom Shapes on a different computer—maybe one received from a colleague or downloaded from Tableau Public—only to find the images aren’t in your repository. What next?
Because a Tableau workbook is ‘just’ an XML file with all date ‘semi-readable’, you can open the .twb file, look for the code of the shapes. The gibberish between each <shape name=…> and </shape>

On a site like Base64.guru you can convert this code to a file.
This is an old trick, but I wasn’t aware of it until Tableau’s Matthew Miller mentioned it during the DataSlam @ DataFam tip battle between Tableau and the community. It was a highly appreciated tip, and his team came close to winning the battle…
But what if you have a workbook with many shapes? And what to do with .twbx files? There is a simpler way if you have access to the Python programming language – available on any Mac/Linux pc, and installable available in the Windows Store.
Python Script “extract-tableau-shapes.py”
To make the ‘mass export’ of shapes easier, I created a small Python script which does all the work for you:
- It unpacks a packed workbook (.twbx) if necessary
- Then it reads the original twb file, and scans it for custom shapes
- If custom shapes are embedded in the workbook, it extracts them, and saves them in a subfolder ‘Shapes’
The script can be downloaded from the GitHub repository
Usage
You need to have Python3 installed, and – in most cases – no extra modules. In a terminal / on a command line you enter these commands:
python extract-tableau-shapes.py path/to/your/workbook.twb(x) [outputdir] [tmpdir]
For Example:
python extract-tableau-shapes.py my_workbook.twbx
In the folder ‘Shapes’ you will get one or more sub-directories with all the embedded shapes.
A screen-recording to show you how this look likes on Mac (and very similar to Windows) – which also shows how fast this is:
Please let me know if you find this useful – and any form of feedback/suggestion/… is welcome at tableaudev@antichaos.net!