

Now you can simply import this excel on Tableau Prep, add a script just as before and you would be good to output all the desired information to a file at your desired location using the ‘Output’ option when you hit the + icon as the last step. a column with ‘dummy’ as a column header and 1,2,3 as values since Prep needs a source file to start. Finally, I have ended with a get_output_schema function, defining only the fields I needed with their respective datatypes.īefore you run this script, you would have to import an excel sheet with dummy values i.e.

Since the output is in JSON format, I have next converted it into a dataframe to do any other data manipulation if needed. Note that in my ‘response.get’ call, I have not defined parameters since the CoinGecko website already provided me the curated URL with parameters included. Here I have imported the requests library to be able to make a get request on the URL. Python Script for making API request (Image by Author) With a similar syntax breakdown, this is what the Python script for this would look like: On similar lines, you can also leverage the power of scripts to make API calls and analyze constantly changing data.įor this example, I will be using to make requests for obtaining the market data for the top 100 cryptocurrencies. Tableau Prep with its entire suite of connectors can pretty much connect to data coming from various databases/ big data warehouses in the form of SQL queries or Cloud services thus ensuring your dashboards are up to date depending on the refresh frequency. Case 2: Using Tableau Prep & TabPy to make API requests

The script should now run successfully to process your dataset and clean it the way you defined it in your script. py file here and select the function name you defined. This should establish the connection as you see here. Select your server as localhost and Port as 9004 (what you got in the command prompt window) and hit Sign in. This will open up the Settings pane at the bottom where you will select TabPy Server and add the localhost connection by going to Help (at the top) > Settings & Performance> Manage Analytics Extensions Connection. TabPy Server Connection Details (Image by Author) It is in a format that needs to be changed to a more ingestible format for Tableau. Notice the Stands table which gives the list of which stands can be accessed by which gates at an airport terminal. My intention here is not to solve the challenge but to use an excerpt from this flow and show how the data manipulation could be achieved either with in-built features or using the Script feature.
#TABLEAU PREP OUTPUT TO EXCEL DOWNLOAD#
You can also download the source files, Tableau Prep flows, and Python scripts here in case you would like to follow along. I would strongly encourage you to go check this out if you want to challenge yourself with the best ways to prep data (& compare with the provided solutions). Case 1: Using Tableau Prep Features & Python Script interchangeably:įor this example, I have selected a dataset from the Week 48 Challenge. Tableau Prep allows you to handle these changes independently and transition into a cleaned output file for analysis. However, when you are dealing with data where fields might change (courtesy: collaborative worksheets) followed by a pivoting of rows to columns/ unpivoting of columns to rows, it becomes prone to breaking when the source file gets refreshed. For all the data prep nerds out there, I wanted to walk you through a couple of examples of when Scripts on Tableau Prep can prove to be extremely handy.įor most of the cases, Joins & Blends, Level of Detail (LOD) Calculations, and limited Data manipulation that Tableau Desktop allows might suffice. Does that sound like you? That was definitely me a couple of months ago until I discovered the power of scripts: a feature that was released just last year. While Tableau Prep has been around for quite some time, not every Tableau user can vouch for using it extensively.
