2

I am wanting to do a visual table-structure comparison of feature classes in an enterprise GDB to feature classes in a File GDB. Just want to compare things like field names and types.

Is there a way to quickly export the table structure from GDB to Excel?

I don't need the actual data, just the field names and types, and maybe alias. Export table structure information to Excel QGIS or MapInfo is a similar question (but for different GIS software).

I know I can get this information by using ArcPy Describe, but I really don't want to spend much time on it, and am thinking there's possibly a right-click type function in ArcCatalog, or maybe something in Toolbox, I just can't find anything right now. The closest I've found is exporting the workspace XML, but this is a bit messier than I'd like.

Is there a tool or function in ArcGIS Desktop to output the table structure to Excel (XLS, XLSX, CSV, etc)?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Feb 14, 2022 at 16:50
2
  • 1
    @BERA Indeed - that will be my go-to if there isn't something quicker/easier that I've missed somehow. Commented Feb 14, 2022 at 17:04
  • 1
    XRay for ArcCatalog is the way to go for documenting your GDB schema. See: arcgis.com/home/item.html?id=35e14ba8a03d49188ee8ead2e79f24d3 . It's not for Excel particularly (although I did once write a script to parse the HTML into CSV for import to Excel). The HTML output that it can produce is the best way to document and review GDB schema. Commented Feb 14, 2022 at 21:13

1 Answer 1

2

This code will output the field info for all the tables to a spreadsheet.

import pandas as pd
import openpyxl
# define workspace and output
arcpy.env.workspace = r"path\to\gdb.gdb"
excel_file = r"spreadsheet.xlsx"
writer = pd.ExcelWriter(excel_file, engine='openpyxl')
#for each table
for tbl in arcpy.ListTables():
 #create empty pandas dataframe
 df = pd.DataFrame(columns = ['Name', 'Alias','Type','Length','Domain'])
 #loop through fields and add rows to df
 for field in arcpy.ListFields(tbl):
 df.loc[len(df.index)] = [field.name, field.aliasName, field.type, field.length,field.domain]
 #then save to Excel
 df.to_excel(writer, sheet_name=tbl,index=False)
writer.save()
answered Feb 18, 2022 at 20:11

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.