A Step-by-Step Guide to Tableau Python Integration

As the data world evolves, Tableau has become a powerful tool for transforming complex data into insightful visualizations. With Tableau offering several built-in functionalities, integrating Python with Tableau further opens up a new realm of possibilities.

In Tableau you can use Python libraries and data processing functionalities, enabling you to create even more engaging and interactive visualizations.

In this article, I will walk you through a step-by-step guide on how to integrate Python with Tableau, exploring the potential of both tools.

Let’s get started!

Setting Up the Environment: Requirements

For successful integration, you must have the following application installed:

  • Tableau Desktop: This is a paid Tableau version that offers several connectivity options, data visualization, and business intelligence products. You can download it on the official Tableau website and install it.
  • Python: You also need to download the latest Python (3.11.4) version from the official Python website.

How to Integrate Python and Tableau

Depending on your specific needs and technical requirements, there are different ways to integrate Python and Tableau. Let’s explore the common ones:

1. TabPy (Tableau Python Server): This enables successful integration, allowing Tableau to execute Python applications and code. TabPy can be installed as a server or a local instance, depending on your deployment preferences.

2. Tableau Extensions: These are add-ons that allow you to integrate external functions and tools into Tableau. With this, you can extend Tableau’s capabilities and incorporate custom data processing, analytics, or visualizations.

A Step-by-step Guide to Connecting Tableau with Python

Now that you understand the different methods available, let’s dive into a step-by-step guide on how to connect Tableau with Python using both methods:

1. Using TabPy (Tableau Python Server)

After you have installed both Tableau Desktop and Python, the next step is to enable TabPy in Tableau. Follow these steps to do that:

  • Open a command prompt (Windows) or terminal (Mac or Linux) on your computer.
  • In the command prompt or terminal, run the following command to install TabPy:
pip install tabpy
tableau python integration - monocroft
TabPy Installation in Command Prompt

After installing TabPy, the next thing is to start the TabPy Server and you can do that by running the following command in the command prompt or terminal:


Run this command by clicking the “enter” button, and if your TabPy server is not configured, it will ask if you wish to continue and you can select (y/N) to either configure it or leave it unconfigured.

This process will open a new window to “allow access” or “cancel.” Click on “allow access” to continue.

After setting up TabPy, the next thing is to connect Tableau to the TabPy server. Follow these steps:

  • Launch Tableau Desktop and navigate to the “Help” menu. Then click on “Settings and Performance” and select “Manage Analytics Extension Connection.”
tableau python integration - monocroft
  • Select TabPy and enter the server information (localhost:9004).
tableau python integration - monocroft
  • Finally, click on “Test Connection” and you should see this to confirm successful integration.

Now with TabPy connected to Tableau, you can start using Python scripts in Tableau calculations. You can create a new calculated field in Tableau or edit an existing one.

2. Using Tableau Extensions

After downloading the required tools (Tableau and Python), the next thing is to enable Tableau Extensions in your Tableau Desktop.

To do that, open your Tableau Desktop and go to “Help” >> “Settings and Performance” >> “Set Dashboard Web Security” >> “Enable Plugin”

Create Tableau Extensions

After enabling Tableau extensions, you can now create Tableau extensions. Follow these steps:

  • Develop a web application using HTML, JavaScript, React, Angular, etc.
  • Use Python libraries like Flask or FastAPI to handle interactions with Python
  • Implement the backend functionality for data processing, calculations, or any other Python integration.

Package the Tableau Extension

After creating your extension, the next thing to do is to package it, you can make use of the Tableau Extension SDK to package your web application as a .trex file (Tableau Extension).

Install the Tableau Extension

  • Once you have the .trex file ready, log in to your Tableau Online account.
  • In Tableau Server or Tableau Online, go to “Explore” and click on “My Extensions” in the “Extensions” section to view your extensions.
  • Then click on “Import an Extension” and select the .trex file you created
  • After successfully importing the extension, it will be available for use within Tableau Online.
  • Finally, go to the workbook where you want to use the extension and create or open a dashboard in Tableau then drag and drop the extension into the dashboard canvas

Benefits of integrating Tableau and Python

There are a lot of benefits to integrating these two tools. Let’s take a look at some of the key benefits:

1. Advanced analytics: Integrating Python with Tableau allows users to leverage statistical models, machine learning algorithms, and data processing functions to perform complex calculations, build predictive models, and gain deeper data insights.

2. Custom visualizations: While Tableau has in-built visualizations, you may need to create custom visualizations, and with Python integration, you can use libraries such as Matplotlib or Plotly to create customized and interactive visualizations.

3. Automation and efficiency: Python scripting capabilities also allow for the automation of tasks and streamline your data analysis workflows – such as data cleaning, transformation, or aggregation.

4. Flexibility and scalability: By integrating Python with Tableau, you can into the Python libraries ecosystem, tools, and frameworks for data analysis, machine learning, and web development., allowing for more complex and scalable solutions.

5. Real-time data analysis: Finally, Python’s ability to connect to different sources, and perform real-time analysis, makes it an ideal match for Tableau. Python can help you analyze data in real time.

Finally, by combining the strengths of these two tools, you can unlock a whole new level of data visualization and analysis.


Can you use Python scripts in Tableau Public (free)?

No, you can’t use Python scripts in Tableau Public. It is a free version of Tableau has comes with some limitations. You can only use the paid version of Tableau — Tableau Desktop.

What are the Python libraries you can use in Tableau?

In Tableau, you can use popular libraries like NumPy, Pandas, and Scikit-learn.

Which method is the best for integrating Python with Tableau?

No method is the best or worst. The choice depends on your use case and requirements.

  • TabPy is easier to set up, which makes it suitable for a fast Python integration, and works well for calculations and data processing tasks.
  • Tableau Extensions allows you to perform more complex, advanced analytics and custom visualizations.

How can you create Tableau Extensions?

To create a Tableau extension, you must develop a web application with Python backend, and package it as a .trex file. Then install the extension in Tableau.

What are common use cases for Python and Tableau integration?

Common use cases include advanced statistical analysis, custom data processing, machine learning model deployment, geospatial analysis, sentiment analysis, etc.


Integrating Python with Tableau opens up a world of possibilities for data professionals as it opens up numerous possibilities to analyze data and create more interactive and engaging visualizations.

By following this guide, you can seamlessly connect Tableau and Python, and explore the potential of both tools for better data insights.

Happy analyzing!