Data comes in many different shapes and sizes, from Excel to databases. Tableau Desktop has a variety of data connection options, from files to databases to saved data connections. This blog will explore how to connect and use different data sets within your Tableau workbook.
1. Connecting to Data
The first screen when you open Tableau is the Start Page, consisting of three panes: Connect, Open
(and recently connected workbooks) and Discover.
2. Searching for Data The Search for Data option allows you to connect to a data source that has been published. To connect to a data source on Tableau Server/Online instance: a. On the Start Page, click Tableau Server. b. Login to your Tableau Server instance. c. Once connected to the server instance, you will see the pop-up box that lists all the data sources available on the server. Select a data source and click Connect.
d. You will be connected to the data source and the Tableau Workspace.
3. Connecting to a File
This is the most commonly used method to connect to data. You can connect to Excel, Text, JSON, PDF, Spatial, Statistical, and many more types of files. Let's see how to connect to an excel file.
To connect to an Excel file:
a. On the Start Page, under the To a File section, click Microsoft Excel.
b. This will bring up the File explorer where you can search for the file.
c. Once you select the file and click Open, the data source page will open.
d. Choose the sheet that you want to work with. e. Double-click the sheet to automatically ad it to the canvas within the data source page. You can also drag and drop the sheet to the canvas section in the middle.
You are now all set to start your data analysis on the selected sheet.
When connecting to different file types, the settings might vary.
A CSV connection will automatically bring the CSV onto the data source canvas once you click Open.
When connecting to a JSON file, you have to select the schema. It will allow you to bring in certain levels of detail from your JSON files.
When connecting to a PDF file, you have to select the pages. The PDF input will look for tables within.
In case of a spatial file or statistical file, once connected Tableau will bring in the file to the canvass, unless there are multiple tabs/sheets. In this case, you have to add the sheet to the canvas manually.
4. Messy Data Sources Messy data source could range from simple data preparation to something more complex.
Let's consider a scenario where you connect to a formatted Excel spreadsheet, nicely styled for Excel use, where the actual headers do not start in the first row.
a. Connect to the Excel sheet and add the data sheet with the incorrectly placed headers to the canvas. You
will notice that the data isn't correct in the data grid.
b. To rectify this, in the left pane under Sheets, check the Data Interpreter checkbox. The Data Interpreter
looks at your file and understands the data.
c. Tableau removes the unnecessary rows that do not match the other rows.
While using the Interpreter, Tableau gives you the option to review the interpreted data.
If you select "Review the Results", an Excel sheet containing all the changes made will open.
Note that, using the Data Interpreter will not change the raw data (original file). It only changes the data that is viewed and used in Tableau.
5. Connecting to a Server
Connection to a server allows Tableau to connect to databases or cloud-based data. Let's see how to connect to a Google Sheet.
a. In the Connect pane, under "To a Server", select More -> Google Sheets
b. Tableau will open a browser window with "Google account login" screen.
c. Google will prompt you to authorize Tableau to access your Google Drive files.
d. Once you allow access, you will be able to see the Google sheets associated with your account. You can
use any data source and connect to it on Tableau.
6. Saved Data Sources
The final section on the Connect Pane is for connecting to Saved Data Sources. To connect to a saved data source and add a new saved data source:
a. In the Connect Pane, select Saved Data Sources. This will take you to the new worksheet to start your analysis. b. To add a data source to the Saved Data Sources, right-click Data at the top left and choose "Add to Saved Data Sources".
c. You will now be prompted to save this file into your Tableau Repository as a .tds file (Tableau Data Source). Save it and the file will appear under the Saved Data Sources section.
Saved Data Sources gives you quick access to data sources that's regularly used. You can also repeat the process for any database connection to save the connection string.