AnsweredAssumed Answered

Export Attributes from Arcmap without Geometry fields

Question asked by 2CQuiker on Nov 1, 2019
Latest reply on Nov 19, 2019 by JB1234510

I need to export attributes from a certain layer in Arcmap but without the OID & Geometry fields to excel.

I've tried the following bet i am getting error ("AttributeError: DescribeData: Method areaFieldName does not exist") on line 15. I would appreciate any help with the code, thanks.



import arcpy
import os

arcpy.env.overwriteOutput = True
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
lyr = arcpy.mapping.ListLayers(mxd, "Notified")[0]

arcpy.env.workspace = os.path.dirname(mxd.filePath)
wp = os.path.dirname(mxd.filePath)

fc = "Notified"
desc = arcpy.Describe(fc)
f = desc.fields
fields = [ for f in f if != desc.OIDFieldName and f.type != 'Geometry' and != desc.areaFieldName and != desc.lengthFieldName]
for fld in fields: 

arcpy.MakeQueryTable_management(fc, "tmp_table", "NO_KEY_FIELD")
arcpy.TableToExcel_conversion("tmp_table", Notified_xls)