Connecting to Text File in Tableau

In this article, we will show you how to connect Tableau to Text Files. Moreover how to use the data present in Text Files (such as .txt, .csv, .tab, .tsv) as Tableau Data Source with an example.

Steps involved in Connecting to Text File in Tableau

Before we start connecting Tableau to text file or csv, let us see the data present in the Text File. From the below screenshot, it’s just a standard text file with .csv extension. If you carefully observe, the First row has the Column names

Connecting to Text File in Tableau 1

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 Tableau Connect section, Please select the Text File Option

Connecting to Text File in Tableau 2

Once you chose the Text File Option, a new window will open to select the Text File from our file system. For now, we are selecting the Custmers.csv file

Connecting to Text File in Tableau 3

Once you have completed, the below screenshot will appear. Please understand the following option before you start creating a report

  1. Customers are the default data source name (In fact, Text Filename) assigned by the Tableau. Please change this default name to a more meaningful unique name as per your requirements
  2. Directory: This section will display the Directory address of the selected Text File. In short, it will show File Path.
  3. Files: This section will display the number of Text Files we selected in the Text File source. In this example, we have selected only one file so, it is showing Customers.csv, but in real-time, you may work with more. We have the search bar under this section, and it is useful for a large number of files. For instance, If you have 20 or 30 files, you can use this to search for a specific file name
  4. Drag Sheets Here: You have to Drag File(s) from Files to this Section. Tableau will only use the files present in this area, something like Dataset.
  5. This region will show the data present in our Dataset
Connecting to Text File in Tableau 4

We can add the text files to Region 4 in Multiple Ways: As the Name suggests, Either we can Drag the Customers.csv file from Region 3 to the 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. After finishing the date review, click on Sheet 1 to design the Tableau Report

Connecting Tableau to Text File 1

Oops, We forgot to tell you the most crucial property called Info.

Qualifiers will separate data present in every text file (does not matter with the extension name), and it may have column names as the first row. To configure these settings, Please select the Text file in the 4th region, and click on the Info button

Connecting Tableau to Text File 7

Once you click on Info button, a new drop-down window will open to configure the 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 set as YES but changes as per your file requirements.
  • Filed Separator: Please select the character that is used to separate the columns in the text file. If a 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 it for you. If not, Please change it manually.
  • Locale: Language used to parse the Text File. Tableau will use this to separate the numbers
Connecting Tableau to Text File 8

Once you finished, click on the Sheet 1 tab to design the report.

  1. Data: This will display the list of currently connected data Sources. We have only one at this time. Otherwise, it shows all the data sources available.
  2. Dimensions: You can place the columns with string data under the Dimensions section
  3. Measures: You can place columns with Numeric data or Metric values under the Measures section
  4. It is the region where we design our Tableau reports by dragging Measures and Dimensions
Connecting Tableau to Text File 9

Comments are closed.