Text File

This topic describes how to connect Tableau to a text file data and set up the data source. Tableau connects to delimited text files.
  1. Click Connect to Data.
  2. On the Connect page, click Text File, select the text file that you want to connect to, and then click Open.
    To connect to the text file using the Microsoft Jet-based connection, in the Open dialog box, click the Open drop-down menu, and then select Open with Legacy Connection. The data source page displays.
  3. On the data source page, do the following:
    1. (Optional) Click the default data source name at the top of the page, and then type a unique data source name for use in Tableau.The default name is automatically generated based on the file name.
    2. Click Go to Worksheet to start building the view.
      Alternatively, drag additional tables to the join area and use conditions to join them. You can choose to combine tables or use Custom SQL when you are working with multiple tables. You can also add joins later.

Optional Settings

You can set the following options before building the view.

Set text file options

In the join area, hover over the table name until the gear icon displays, click the icon, and then specify the following:
    • Select whether the first row contains column names. This option is selected by default. Alternatively you can have Tableau generate names when you connect. These names can be changed later.
    • Select the character that is used to separate the columns. Select from the list of characters or select Other to type in a custom character.
    • Select the text qualifier that encloses values in the text file.
    • Select a character set that describes the text file encoding. The available encodings are based on the operating system you are using. For example, on Windows, ANSI is listed as windows-1252 and OEM is listed as 437.
      Note: In workbooks created prior to Tableau Desktop 8.2 or use the legacy connection, you can select ANSI, OEM, UTF-8, UTF-16, or Other. When you select Other, you must specify the character set in the provided text field. This value is verified when the connection is attempted.
    • Select the locale by which the file should be parsed. This option tells Tableau which decimal and thousands separator to use.

Preview data and change data types

The first 10,000 rows of the data in the data source is automatically displayed below the join area. If you add tables, remove tables, or make changes to the join conditions, the preview updates. You can also do the following in the preview area:
  • Change the data type of a column by clicking the data type icon.
  • Rename or hide a column by clicking the column header drop-down menu and selecting the respective option.

Connect live or use an extract

At the top of the data source page, select a live or extract connection to the data source. If you choose to take an extract, an Edit link will display allowing you to set up filters that define the subset of the data to include in the extract.

Add data source filters

Add data source filters to restrict the visibility and use of the fields in the data source.

Best Practices

If all text files for a multi-table connection are in a separate directory, there is no possibility that users will inadvertently select a file that is not appropriate for the connection.

An example of a text file data source is shown below.

Note: If the text file contains columns that are more than 254 characters wide, Tableau is not able to use these fields for workbooks that were created before Tableau Desktop 8.2 or use the legacy connection. Either remove the columns, modify them to fit within 254 characters prior to connecting in Tableau, or upgrade the text file data source. Large text files often perform poorly as a data source, because the queries are slow.

1 comment: