Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Create a Data Dictionary for ArcGIS Pro Feature Classes
# generate a data dictionary from an ArcGIS feature class
# tested with ArcGIS Pro/Python3
# Run from command prompt in ArcGIS Pro environment
# Takes 2 arguments: 1) path to feature class 2) path for output CSV file
# Example: python C:\ C:\yourgeodatabase.gdb\featureclassname C:\output.csv
import arcpy
import sys
import csv
table = sys.argv[1]
outfile = sys.argv[2]
fields = arcpy.ListFields(table)
headings = ["name", "alias", "type", "length"]
data = [headings]
for field in fields:
row = [, field.aliasName, field.type, field.length]
file = open(outfile, 'w', newline='')
with file:
writer = csv.writer(file)
print('CSV file written')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment