01 / 24

Connecting to
Data Sources

Learn how to connect Tableau to files, spreadsheets, and databases to start building powerful visualizations from real data.

Tableau

What Is a Data Source?

A data source is any structured collection of information that Tableau reads and transforms into visual analytics. Before you can create a single chart or dashboard, you need to tell Tableau where your data lives and how to read it.

Three Main Source Types

Files
CSV, Excel, JSON, PDF, and text files stored on your local machine or network drive.
Databases
SQL Server, MySQL, PostgreSQL, Oracle, and other server-hosted relational databases.
Cloud Services
Google Sheets, Salesforce, Amazon Redshift, Snowflake, and other web-based platforms.

Why Connections Matter

The way you connect to data determines performance, freshness, and security of your dashboards. A poor connection setup leads to slow load times, stale numbers, or even data breaches.

1
Performance: Live connections query the server each time; extracts cache data locally for speed.
2
Freshness: Scheduled extract refreshes keep dashboards up to date without manual work.
3
Security: Database credentials and permissions ensure only authorized users access sensitive data.

The Connection Workflow

Start Page Open Tableau Choose Source File / DB / Cloud Configure Path / Credentials Preview Data Check columns Go to Sheet Start visualizing Step 1 Step 2 Step 3 Step 4 Step 5

Live vs. Extract Connections

Live Connection Extract (.hyper)
Data freshness Real-time Scheduled refresh
Performance Depends on server Fast (local cache)
Offline access No Yes
Best for Small, fast databases Large datasets, travel

Connecting to Excel Files

1
Open Tableau and click "Microsoft Excel" under the "To a File" section on the Start Page.
2
Browse to your .xlsx or .xls file and click Open.
3
Drag a sheet from the left panel into the canvas area. Tableau previews your data automatically.
4
Verify column names and data types (Abc = text, # = number, calendar = date).
5
Click "Sheet 1" at the bottom to start building your visualization.

Connecting to CSV Files

CSV (Comma-Separated Values) files are the simplest data format. They contain plain text rows with values separated by commas, making them universally readable by almost any tool.

1
Click "Text file" on the Start Page (CSV files are text files).
2
Select your .csv file. Tableau auto-detects the delimiter (comma, tab, semicolon).
3
Check the preview: ensure the first row is recognized as field names, not data.

Connecting to a Database

Tableau Desktop Connection Info Server: hostname Port: 3306 Database: sales_db Auth: user / pass MySQL Tableau sends SQL queries through the connection

Database Connection Steps

1
Select your database type under the "To a Server" section on the Start Page (e.g., MySQL, PostgreSQL, SQL Server).
2
Enter the server name (hostname or IP address) and the port number.
3
Provide credentials: username and password, or use Windows Authentication if available.
4
Select the database from the dropdown, then drag tables or write Custom SQL to define your data.
5
Choose Live or Extract and click "Sheet 1" to begin analysis.

The Data Source Page

Tables Panel Orders Customers Products Returns Canvas (Drag tables here) Orders Customers J Inner Join Data Preview Grid Order ID Customer Sales Region 001 Alice $1,240 East 002 Bob $890 West Live / Extract

Joins and Unions

Join
Combines columns from two or more tables based on a matching field (e.g., Customer ID). Places data side by side.
Union
Stacks rows from similar tables on top of each other. Tables must share the same column structure (e.g., January + February sales).
Join (side by side) Table A 3 cols + Table B 3 cols = 5+ columns wide Union (stacked) Table A rows Table B rows = More rows tall

Recognizing Data Types

When Tableau reads your data, it assigns a data type to each column. Getting these right is critical: a zip code stored as a number loses leading zeros, and a date stored as text cannot be used for time-series analysis.

Abc String
Text values: names, categories, IDs that should not be summed.
# Number
Integers and decimals: sales amounts, quantities, scores.
Date
Dates and date-times: order date, timestamp, year-month.
Bool
True/False values: is_returned, has_discount, active.

Example: Sales CSV

You receive a file called monthly_sales.csv containing order data from your company's e-commerce platform. Let's connect it to Tableau.

1
Open Tableau Desktop. On the Start Page, click "Text file" under "To a File".
2
Navigate to monthly_sales.csv and click Open.
3
Tableau shows the preview: columns for Date, Product, Quantity, and Revenue. Verify that Date shows a calendar icon, not "Abc".
4
Choose Extract for faster performance, then click "Sheet 1".

Example: Multi-Sheet Excel

Your manager gives you Q4_Report.xlsx with three sheets: October, November, and December. Each sheet has the same columns. You need all three months in one view.

1
Click "Microsoft Excel" and open Q4_Report.xlsx. The left panel shows all three sheets.
2
Drag October to the canvas. Then drag November directly below it: Tableau offers a Union option.
3
Drop to create the Union. Repeat with December. Tableau adds a "Sheet" column so you know which month each row came from.
4
The preview now shows all three months stacked with consistent columns. Click "Sheet 1" to begin.

Example: MySQL Database

Your school's IT department provides access to a MySQL server hosting student enrollment data. You need to connect Tableau to it.

1
On the Start Page, select "MySQL" under "To a Server". Install the MySQL driver if prompted.
2
Enter the server: db.school.edu, port: 3306, username and password provided by IT.
3
Select database enrollment_db. Drag the students and courses tables to the canvas.
4
Tableau auto-detects the join on student_id. Verify it in the join dialog and choose Live for real-time updates.

Common Mistakes

✕ Wrong Data Type
Zip codes or phone numbers stored as numbers lose leading zeros. Always verify and change to String.
✕ Missing Driver
Forgetting to install the database driver before connecting. Tableau will show a connection error.
✕ Headers as Data
If Tableau reads column names as the first data row, toggle "Field names are in first row" in the settings.

Summary Comparison

CSV / Text Excel Database
Connector "Text file" "Microsoft Excel" Server name (e.g., MySQL)
Setup Browse to file Browse to file Server + credentials
Multi-table Union (wildcard) Join / Union sheets Join / Custom SQL
Live support Yes Yes Yes
Best for Simple flat data Multi-sheet workbooks Large, relational data

Key Takeaways

1
Start Page is your gateway: all connections begin from the left panel under "To a File" or "To a Server".
2
File-based sources (CSV, Excel) require only a file path. Database sources require server address, port, and credentials.
3
Joins combine columns side-by-side. Unions stack rows from identically structured tables.
4
Always verify data types in the preview before starting your visualization to avoid costly errors.
5
Extract for speed, Live for freshness. Choose based on your dashboard needs.

Question 1 of 5

Which connector should you use in Tableau to open a .csv file?

Question 2 of 5

What is the key difference between a Join and a Union in Tableau?

Question 3 of 5

When connecting to a MySQL database, which of the following is NOT required?

Question 4 of 5

You notice that a column of zip codes in your data preview shows values like 1234 instead of 01234. What should you do?

Question 5 of 5

Which connection type would you choose for a large dataset when you need fast dashboard performance and do not need real-time updates?