CUSTOMISED
Expert-led training for your team
Dismiss
How to Use Tableau Extracts

4 April 2023

How to Use Tableau Extracts

 

Tableau extracts are an important feature of Tableau that allow you to extract data from various sources, including databases, spreadsheets, and other files, and then store them in a compact, compressed format for use in Tableau. Extracts can significantly improve the performance of your data visualizations, especially when working with large data sets.

 

In this guide, we will explain how to use Tableau extracts, including how to create, modify, and refresh extracts. We will also provide some code examples to illustrate how to work with Tableau extracts.

 

Creating a Tableau Extract

 

To create a Tableau extract, follow these steps:

1.     Connect to your data source: Open Tableau, and then click on the "Connect" button on the start page. Select the data source you want to extract data from.

2.     Select the data you want to extract: On the "Connect" page, you can select the tables or sheets you want to extract data from. You can also apply filters to the data if needed.

3.     Create the extract: After selecting the data you want to extract, click on the "Extract" button to create the extract. You can also adjust the settings for the extract, such as the aggregation level, on this page.

 

Modifying a Tableau Extract

 

Once you have created a Tableau extract, you can modify it to suit your needs. To modify a Tableau extract, follow these steps:

 

1.     Open the extract: In Tableau, go to the "Data" menu and select "Extracts." Find the extract you want to modify and open it.

2.     Modify the extract: You can modify the extract in various ways, such as adding or removing fields, changing the data type of fields, or applying filters. To modify a field, simply drag it to the appropriate location on the "Fields" pane.

3.     Save the extract: Once you have made the necessary modifications, click on the "Save" button to save the modified extract.

 

Refreshing a Tableau Extract

 

Tableau extracts can become outdated as new data becomes available in the source database or file. To ensure that your Tableau extract reflects the latest data, you need to refresh it regularly. To refresh a Tableau extract, follow these steps:

 

1.     Open the extract: In Tableau, go to the "Data" menu and select "Extracts." Find the extract you want to refresh and open it.

2.     Refresh the extract: Click on the "Refresh" button to refresh the extract. You can also schedule the extract to be refreshed automatically at certain intervals.

 

import pandas as pd

import tableausdk.Extract as tde

 

data = pd.read_csv("data.csv")

cols = data.columns.tolist()

 

with tde.Extract("data.tde") as extract:

    table = tde.Table("Extract", cols)

    for i, row in data.iterrows():

        newrow = tde.Row(table)

        for col in cols:

            newrow.setCharString(cols.index(col), str(row[col]))

        table.insert(newrow)

    extract.addTable("Extract", table)

 

 

Modifying a Tableau extract:

 

import tableausdk.Extract as tde

 

with tde.Extract("data.tde") as extract:

    table = extract.openTable("Extract")

    schema = table.getTableDefinition()

    schema.addColumn("NewField", tde.Type.INTEGER)

    for i in range(table.getRowCount()):

        row = table.getRow(i)

        row.setInteger(schema.getColumnIndex("NewField"), row.getInteger(0)

 

Refreshing a Tableau extract:

 

import tableausdk.Extract as tde

 

with tde.Extract("data.tde") as extract:

    extract.refresh()

 

 

In this code example, we simply open the extract and call the "refresh" method to refresh it.

 

Use Cases

 

Tableau extracts can be used in many different scenarios, including:

 

1.     Working with large data sets: Extracts can significantly improve the performance of your data visualizations when working with large data sets.

2.     Offline analysis: Extracts can be used to create offline data sets that can be used for analysis when an internet connection is not available.

3.     Sharing data: Extracts can be used to share data with others who do not have access to the original data source.

 

For more information on using Tableau extracts, check out the official Tableau documentation: https://www.tableau.com/

Additionally, JBI Training offers a variety of Tableau courses to help you master Tableau and its features,  including Tableau fundamentals and advanced courses. These courses cover a wide range of topics and techniques in Tableau, including how to create different types of charts, how to use Tableau's scripting language, and how to connect to different data sources.

Conclusion

Tableau extracts are an important feature of Tableau that allow you to extract and store data from various sources for use in Tableau. In this guide, we provided a comprehensive overview of how to use Tableau extracts, including how to create, modify, and refresh extracts. We also provided some code examples to illustrate how to work with Tableau extracts. By following these steps, you can leverage the power of Tableau extracts to improve the performance of your data visualizations and gain insights from your data.

About the author: Daniel West
Tech Blogger & Researcher for JBI Training

CONTACT
+44 (0)20 8446 7555

[email protected]

SHARE

 

Copyright © 2023 JBI Training. All Rights Reserved.
JB International Training Ltd  -  Company Registration Number: 08458005
Registered Address: Wohl Enterprise Hub, 2B Redbourne Avenue, London, N3 2BS

Modern Slavery Statement & Corporate Policies | Terms & Conditions | Contact Us

POPULAR

Rust training course                                                                          React training course

Threat modelling training course   Python for data analysts training course

Power BI training course                                   Machine Learning training course

Spring Boot Microservices training course              Terraform training course

Kubernetes training course                                                            C++ training course

Power Automate training course                               Clean Code training course