Force ArcMap to Recognize Text Fields in a CSV File

arcgis-desktoparcmapattribute-tablecsv

Related to Data-type detection in ArcGIS table loading

I have a CSV file which contains a mixture of numeric and text fields:

ID,Txt,Int,Dbl
12345,abc,45,56.78
12346,9,65,23.12
12347,10,66,23.13

According to this Esri article if the top 8 rows contain a text value, the field will be classified as text, yet I am finding that the second field is classified as Long. This means that the value "abc" is omitted:

enter image description here

How can I force ArcMap to recognise this as a text field, while maintaining the data in CSV format?

A workaround will be to create a geodatabase table, define the field as text, and Load the data, but I'm hoping to keep the table in CSV (it's the output of another process).

Best Answer

Have a look at the "Overriding how text files are formatted" section in the help topic on Adding an ASCII or text file table:

You can override how delimited text files are displayed within ArcGIS by using the schema.ini files. An example of when you would want to use the schema.ini file to override the default behavior is when ArcGIS is misinterpreting a field type. The following example shows how to do this for a field called PLOTS which should be displayed as type Text but is being interpreted as type Double.

[Trees.CSV]
Col14=PLOTS Text

Note that you may need to create a schema.ini file if one is not present and you need to override how delimited text files are displayed in ArcGIS. For more information on the schema.ini file, do a search for schema.ini on the Microsoft MSDN website.

Related Question