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 connect Tableau to a text file or CSV, let us see the data in the Text File. From the below screenshot, it’s just a standard text file with a .csv extension. If you carefully observe, the First row has the Column names.

Text File 1

If you haven’t started Tableau yet, Double click on the desktop to open for connecting with a text file.

Once it is open, it looks like the below screenshot. First, Under the Tableau Connect section, Please select the Text File Option. For more Data Sources >> Click Here.

Connecting to Text File in Tableau 2

Once you choose 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.

Choose csv file from local hard drive 3

The screenshot below will appear once you have completed Connecting to Text File in Tableau. Please understand the following options before you start creating a report.

  1. Customers are the connected default data source name (Text File name) assigned by 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 the File Path.
  3. Files: This section will display the number of Text Files we selected in the Tableau 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 must Drag the File(s) from the 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, we can Drag the Customers.csv file from Region 3 to the 4th region or simply double-click on the required file, which will automatically add.

TIP: Tableau allows us to connect and add multiple text file tables using Joins.

Once you drag the Customers file, the Preview region will display the data in that .csv file. After finishing the date review, click on Sheet 1 to design the Tableau Report.

Connect Txt Live or Extract 1

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

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

Connecting Tableau to Text File 7

Once you click on the Info button, a new drop-down window will open to configure the following items:

  • Does the file include 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 set as YES but changes as per your file requirements.
  • Filed Separator: Please select the character used to separate the columns in the text file. Select Other and type a custom character if a character is absent in the list.
  • Text Qualifier: Please specify the text qualifier used to enclose 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.
Choose the Field Separator, Text Qualifiers 8

Once you have finished, click on the Sheet 1 tab to design the tableau report from a connected Text File.

  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.
Design Report using Txt File Data 9

Comments are closed.