How do I export an attribute table to dbf or txt format by use of Python in ArcGIS 10?

  • 2
    Why would you export .dbf to .dbf? Is there any other requirment? – Tomek May 16 '11 at 9:04
  • 3
    @Tomek Your response was converted to a comment to preclude downvotes due to it not being a proper reply. – whuber May 16 '11 at 13:24
  • 1
    I was recently asked to create a script to convert from feature table to csv simply because dbf is a nightmare and a half. I would recommend going text, personally, and converting elsewhere if necessary. – Nathanus May 16 '11 at 14:48
  • Very similar question about exporting to XLS that you could probably customize to help with your own implementation. – RyanKDalton Aug 30 '12 at 19:39

Or, using ArcPy and the arcpy.ExportXYv_stats tool, just specify exporting to a csv. The super-easy way to do it is to use ModelBuilder to build a tool with the 'Spatial Statistics' -> 'Utilities' -> 'Export Feature Attribute to ASCII' utility, specify exactly how you want it to be exported (.csv, tab delimited, whatever), and then export the model builder script to python. Then you can run that script in a loop for all your files.

|improve this answer|||||
Import arcpy

I suggest reviewing ArcGIS Online help.

|improve this answer|||||

I'm not familiar with ArcPy yet, but I have done many conversions like this using arcgisscripting.

With arcgisscripting, you could use a SearchCursor to read the table and Python has a great csv module for reading and writing to csv files.

All you need to do is load each row of the SearchCursor into a python list object and the csv writer object will write the list to the output file using the writer.writerow(list) method.

|improve this answer|||||
  • Exactly what I did! +1 – Nathanus May 16 '11 at 18:23
  • This is a good solution because the TableToTable_conversion tool doesn't support exporting to CSV. – Fezter Jun 23 '14 at 0:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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