AnsweredAssumed Answered

Export file geodatabase table to scv file

Question asked by claudines on Mar 18, 2013
Latest reply on Mar 19, 2013 by claudines
How can I export a file geodatabase to csv table using python running a script from inside a map document.

Got the following code from Mathew Coyle off this forum and ran it but it did not work for me.

Other ideas?

import arcpy from os import path as p fc = "C:\\Test\\Test.gdb\\Test1" CSVFile =  "C:\\Test\\Test1" def TableToCSV(fc,CSVFile):          fields = [f.name for f in arcpy.ListFields(fc) if f.type <> 'Geometry']     with open(CSVFile, 'w') as f:         f.write(','.join(fields)+'\n') #csv headers         with arcpy.da.SearchCursor(fc, fields) as cursor:             for row in cursor:                 f.write(','.join([str(r) for r in row])+'\n')     print 'Created %s Successfully' %p.basename(CSVFile)

Outcomes