Adding an ASCII or text file table

In ArcGIS, you can directly access data in delimited text files and work with them as tables. ArcCatalog and the Add Data dialog box in ArcMap list files with .txt, .asc, .csv, or .tab extensions and assign them a file type of text file.

Files with a .txt, .asc, or .csv extension are interpreted as comma delimited, while files with a .tab extension are interpreted as tab delimited by default. Any file with one of these extensions will be interpreted as a text file table even if it doesn't contain tabular data. If you attempt to display a text file that doesn't contain tabular data, the software will either produce an error or attempt to display the data as a table. To avoid this problem, give your delimited text files a .csv or a .tab extension. This will help differentiate text files with delimited data from unformatted text files.

The first row of your text file can contain the column headings. The following rows can contain coordinates and attributes. Remember to use commas or tabs to distinguish the columns. The following is an example of a comma-delimited text file:

99.3,77.0,002,blue and red

This can be previewed in ArcCatalog or added as data in ArcMap and will appear as shown:

ASCII Table example

Setting your own text delimiter

ArcGIS uses the Microsoft OLE DB provider for Open Database Communication (ODBC) drivers and the Microsoft ODBC Text Driver for text files to access tabular data in text files. The driver stores data description (schema) information about each text file in a file named schema.ini so the data can be accessed properly. This file refers only to the text data files in the directory in which it resides.

Every directory with text files and for which you have write access will contain a schema.ini file once you have browsed or opened that directory with ArcCatalog or ArcMap. An entry defining the delimiter is added to this file for each text file in the directory. Information is also written to the schema.ini file when data is exported to a text file. If the schema.ini file does not already exist in the directory, it is automatically created.

ArcGIS uses the file extension to determine how to set the delimiter for each text file. Files with a .txt, .asc, or .csv extension are set as comma-delimited files, while files with a .tab extension are set as tab-delimited files. The following is an example of what will appear in the schema.ini file for a directory with files named, demog.txt, demog.csv, and demog.asc:


If you have text files with a .txt, .csv, or .asc extension and they use a delimiter other than a comma, the data will not be interpreted properly by default. You can modify the schema.ini file to specify the proper delimiter. Once set in the schema.ini file, ArcMap and ArcCatalog will interpret the data correctly. The following examples show how.

For a file named city_demog.txt with a tab delimiter, the following can be set. As an alternative, you can rename the file so that it has a .tab extension:


For a file named customers.txt with a semicolon delimiter, add the following:


If the schema.ini file can't be created in the appropriate directory (for example, a read-only directory), you should still be able to access comma-delimited text files. This is because the ODBC text file driver tries to interpret the text file as comma delimited by default when the schema.ini file does not exist. This means, however, that you will not be able to access tab-delimited data properly in read-only directories. If you encounter this situation, you can manually create the schema.ini file and set the format to TabDelimited for the appropriate files.

Field names

Some characters in field names, such as hyphens (for example, x-coord), spaces, and brackets, are not supported. You should edit the field names in delimited text files to remove these characters before using them. For example, you can use the underscore character instead of the hyphen character in field names.

Exporting text files

When you export tabular data to a text file, a comma delimiter is always used in the output file. In addition, information is added to the schema.ini file to ensure that the fields are exported to the correct data type and set the format to comma delimited. If you look in the schema.ini file after exporting to a text file table, you will see general information, as well as the data type and field width for each field in the output file. A typical example for a file named Export_Output.txt is shown below:

Col1=OID Integer
Char Width=25

For more information on the schema.ini file, do a search for schema.ini on the Microsoft MSDN Web page.

Related Topics