In this article we will show you, How to connect Tableau to Text Files and how to use the data present in Text Files (such as .txt, .csv, .tab, .tsv) as Tableau Data Source with example.
Steps involved in Connecting to Text File in Tableau 9.0
Before we start, Let us see the data present in the Text File. From the below screenshot, it’s just a normal text file with .csv extension. If you observe closely, First row has the Column names
If you haven’t started the Tableau yet, Double click on the Tableau desktop to open. Once it is open, it looks like below screenshot
First, Under the Connect section, Please select the Text File Option
Once you selected the Text File Option, a new window will be opened to select the Text File from our file system. For now, we are selecting the Customers.csv file as shown below
Once you are done, below screenshot will be appeared. Please understand the following option before you start creating report
- Customers is the default data source name (In fact, Text File name) assigned by the Tableau. Please change this default name to more meaningful unique name as per your requirements
- Directory: This section will display the Directory address of the selected Text File. Shortly, it will display File Path.
- Files: This section will display the number of Text Files we selected in the Text File source. In this example we selected only one file so, it is displaying Customers.csv but in real-time you may work with more. We have the search bar under this section and it is very useful for large number of files. For instance, If you have 20 or 30 files then you can use this to search for specific file name
- Drag Sheets Here: You have to Drag File(s) from Files to this Section. Tableau will only use the files present in this area. This is something like Dataset.
- This region will show the data present in our Dataset
We can add the text files to Region 4 in Multiple Ways: As the Name suggest, Either we can Drag the Customers.csv file from Region 3 to 4th region or else simply double-click on the required file will automatically add
TIP: Tableau allows us to add multiple tables using Joins
Once you dragged the Customers file, Preview region will display the data present in that .csv file. Please refer below screenshot to understand the different areas. We will discuss the Connections part in another article.
Once you finished reviewing the data, Click on Sheet 1 to design the Tableau Report
Oops, We forgot to tell you most important property called Info.
Data present in every text file (does not matter with the extension name) will be separated by Qualifiers and it may have column names as first row. In order to configure these settings, Please select the Text file in 4th region and click on the Info button as shown below
Once you click on Info button, a new drop down window will be opened to configure following items:
- Does the file includes field names in the First Row?: We have to specify, whether the selected text file contains column names in the first row or not. By default, this option is selected as YES but change as per your file requirements.
- Filed Separator: Please select the character that is used to separate the columns in text file. If the character is not present in the list, select Other and type a custom character.
- Text Qualifier: Please specify the text qualifier used to encloses values in our selected Text File.
- Character Set: Please select the character set that describes the text file encoding. Mostly Tableau will detect for you, If not, Pleas change it manually.
- Locale: Language used to parse the Text File. Tableau will use this to separate the numbers etc
Once you finished, Click on the Sheet 1 tab to design the report.
- Data: This will display the list of currently connected data Sources. We have only one at this time otherwise, it will display all the data sources available.
- Dimensions: Columns with string data will be placed under the Dimensions section
- Measures: Columns with Numeric data or Metric values will be placed under the Measures section
- This is the region where we design our Tableau reports by dragging Measures and Dimensions
Thank You for Visiting Our Blog