Created
May 5, 2016 05:50
-
-
Save cindygis/ced01db709f52a9be18e57793b007783 to your computer and use it in GitHub Desktop.
Converts a spreadsheet containing field names and aliases into a file geodatabase table.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
@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