In another article we covered how you can query your Tableau view data like a boss, and I received some feedback from one person that they wanted to tumble deeper down the rabbit hole.

That brings us to this article, where we will demonstrate how you can download view data for a table (crosstab) in Tableau, and reconstruct the shape of that data as it appeared in Tableau.

This tutorial walks through using the Python tableau-api-lib package and is part of a series on how to tap Tableau Server like a keg, giving you control over Tableau Server’s REST API.

These tutorials assume you have Python 3 installed already. If you do not have Python 3 yet, this will get you started: guide to install Python.

Setting the Stage

Let’s say you have a crosstab in Tableau and you need to download it for whatever reason. If you go about doing this with the Tableau REST API, you’ll get the data you want… it just won’t necessarily be in the format you need.

The main issue is that when you download the view data, you are not going to get data in the form of a ‘pivot table’ or a crosstab. You’ll have a raw table in database format, where all your dimensions appear as columns.

Let’s see how we can download the data and shape it back into the table or crosstab you had in mind.

#tableau #programming #data-science #data #python

Querying Tableau view data as a crosstab using Python and Pandas
11.20 GEEK