Using an arcpy script how do I get the feature attribute count per feature class in a fileGDB? Ideally I would like to output to a spreadsheet, with the feature class name in one column and the attribute count in another.
Use this function to return all of the feature classes in the GDB:
def listFcsInGDB(): for fds in arcpy.ListDatasets('','feature') + ['']: for fc in arcpy.ListFeatureClasses('','',fds): yield os.path.join(arcpy.env.workspace, fds, fc)
Now loop over that function to work with each individual feature class:
arcpy.env.workspace = "C:\\gdb" for fc in listFcsInGDB(): print fc print arcpy.GetCount_management(fc) <-- number of rows print len(arcpy.ListFields(fc)) <-- number of columns
I've left the part about writing to a spreadsheet up to you.
Note, I haven't tested this so feel free to correct me if I made any mistakes.