
Tableau Prep Cookbook
By :

In this recipe, we'll connect to a Comma-Separated Values (CSV) file containing sales transactions and create a second connection to multiple Excel files. These connection types are very similar and so we'll cover them in one recipe. However, there are key features to both, which we'll highlight.
To follow along with the recipe, download the Sample Files 2.1 folder from this book's GitHub repository.
To get started, ensure you have the sample CSV and/or Excel file(s) ready on your computer and open up Tableau Prep Builder:
Figure 2.1 – Connect to a text file
Figure 2.2 – Select December 2016 Sales.csv
Once selected, Tableau Prep will automatically create a new flow with the data connection in it:
Figure 2.3 – A new flow is created when selecting any text file
Since the data connection is automatically selected, all options onscreen now relate to that particular connection. On the left-hand side, you can see the Tables pane. Note that there is only one table, equal to the filename. Since text files do not contain tables, this is by design. Tableau Prep Builder will always provide a generic user interface for data connections whenever possible. Once you're comfortable with one connection type, others should be easier to master:
Figure 2.4 – Text files such as CSV always have a single table
In the bottom pane, you can find a summary of all data fields identified in your text file, along with the automatically determined data type. In Chapter 3, Cleaning Transformations, we'll dive into the cleaning options you can perform here:
Figure 2.5 – Field summary
Finally, Character Set and Locale are typically identified appropriately but you can alter them here as needed:
Figure 2.6 – Connection settings
Figure 2.7 – Adding a second data connection
Once we've selected the file, Tableau Prep Builder does not automatically show another data connection in the flow, as it did for our CSV file. This is the default behavior for any data connection that has multiple tables. In the case of Microsoft Excel, each Excel sheet is considered a table:
Figure 2.8 – Connections with tables require table selection before you can continue
The colors do not denote any kind of functionality:
Figure 2.9 – A flow with multiple data connections
Figure 2.10 – Multiple Files tab
Figure 2.11 – Multiple Files options
Figure 2.12 – Using wildcards to ingest multiple files at the same time
As a result, this step will now ingest all files in our subfolder named Archive and combine the data:
Figure 2.13 – All sample files here will be ingested at the same time using a single connection
By completing these steps, you have learned how to connect Tableau Prep to text and Excel files.
Tableau Prep text files and Microsoft Excel connections automatically detect most settings very well, so, in most cases, a couple of clicks will get you up and running. The most powerful feature is undoubtedly the ability to ingest multiple files at the same time. You can ingest hundreds of files at the same time using this method, using a single data connection.
Change the font size
Change margin width
Change background colour