I'm having trouble exporting directly an ArcGIS attribute table to a text file (.txt) while I'm working in ModelBuilder. I tried the followings and none of them worked:

  • Copy Rows tool: I tried to add the (.txt) extension to the output table but it still gave a (.dbf) table.

  • Export Feature Attribute to ASCII: It adds the coordinates (X, Y) which are not needed. Also, the order of the attributes is not the same as the one in the table.

  • Export table to Excel: I know that it could work if I export my Excel file to a text file from the Excel panel but I'd prefer having this process completely automatic!


  • 1
    perhaps show the model steps as an image to provide some more information
    – Adam
    Jul 19, 2016 at 23:11

4 Answers 4


A way of converting an attribute table to a comma separated text file is to run the Table to Table tool. The location would be a folder such as c:\temp\mydata and the output table would be test.txt. If you set the field mappings then you can choose which fields get exported.

But you may get yourself into trouble, what happens if a text value contains a comma? Personally I would keep the attribute table in a structured format such as a DBase format as that enforces data integrity. If you have non-roman characters then they may get lost, so a unicode table such as a table in a personal geodatabase is best. Text formats may be simple and easy to understand but a database table takes away the pain...food for thought.

  • I can't export into text file ... always giving me (.dbf). Also, I can't export the Shape_Length field.
    – mattcp2
    Jul 20, 2016 at 13:37
  • You are explicitly adding ".txt" to the end of the name? You could create another field and copy the length into if that geodatabase field does not export? Also I am using ArcGIS 10.4.1.
    – Hornbydd
    Jul 20, 2016 at 13:50
  • Yes I'm explicitly adding (.txt) to the end of the name. My version of ArcGIs is 10.2 so it might be a problem.
    – mattcp2
    Jul 20, 2016 at 14:07
  • 1
    Have you looked at ArcScripts (now called code sharing), that should have been the first place you start looking. There are many user community created tools such as this one which you can embed in your model.
    – Hornbydd
    Jul 20, 2016 at 14:22
  • Thank you very much it worked! I used the TableToCSV script. Worked quite like I wanted. I didn't know about that website so double thank you!
    – mattcp2
    Jul 20, 2016 at 18:21

Export Feature Attribute to ASCII in the Spatial Statistics toolbox can also do such a conversion.


You can do it with a geoprocessing tool. Use toolbox "Conversion toools", go to "To Geodatabase", select the tool "Table to Table". Select input, select output location (a directory). And the crucial part, write .txt in the output table name. It works.


If you don't mind trying arcpy, the following should generally work:

OutputFilePath = r"path\to\file"
with open(OutputFilePath, 'w') as outFile:
    with arcpy.da.SearchCursor(AttributeTableOrFeatureClass, "*") as cursor:
        for row in cursor:
            for val in row:
                outFile.write("%s," % val)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.