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 = [f.name for f in f if f.name != desc.OIDFieldName and f.type != 'Geometry' and f.name != desc.areaFieldName and f.name != desc.lengthFieldName]
for fld in fields:
fields.remove(fields)
arcpy.MakeQueryTable_management(fc, "tmp_table", "NO_KEY_FIELD")
arcpy.TableToExcel_conversion("tmp_table", Notified_xls) <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>