Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Converts a spreadsheet containing field names and aliases into a file geodatabase table.
'''
@date 09/07/2013
@author Cindy Williams
Converts a spreadsheet containing field names and aliases
into a file geodatabase table.
'''
import arcpy
xls = r"C:\Some\Arb\Folder\test.xlsx\Fields$"
tbl = r"C:\Some\Arb\Folder\test.gdb\tbl_Samples"
with arcpy.da.SearchCursor(xls,("FIELD_NAME","ALIAS")) as cursor:
for row in cursor:
arcpy.management.AddField(tbl, row[0], "DOUBLE", field_alias=row[1])
print("Adding field {}...".format(row[0]))
print("Fields added successfully.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.