Is it possible to convert a table from excel to coded domain in arcmap?

1035
3
02-22-2019 03:29 AM
TrygveRagnarsøn
New Contributor

I have succeded when creating own dictionary:

domDict = {"code":"code description", (...) "code": "code description}

for code in domDict:

...     arcpy.AddCodedValueToDomain_management("file.gdb", "domain name", "code", "domDict

")

But after importing excel table i get it into this format (i.g. american presidents {0: u'George Washington', 1: u'John Adams', 2: u'Thomas Jefferson', 3: u'James Madison', 4: u'James Monroe', 5: u'John Quincy Adams', 6: u'Andrew Jackson', 7: u'Martin Van Buren', 8: u'William H. Harrison' }

i am wondering how to get dictionaries like this into my code above.

0 Kudos
3 Replies
KoryKramer
Esri Community Moderator

Have you looked into Table To Domain—Help | ArcGIS Desktop ?

TrygveRagnarsøn
New Contributor

When I use the Table to Domain management i seem to get this error:

Runtime error  Traceback (most recent call last):   File "<string>", line 1, in <module>   File "c:\program files (x86)\arcgis\desktop10.6\arcpy\arcpy\management.py", line 1798, in TableToDomain     raise e ExecuteError: ERROR 000308: Invalid field type  

0 Kudos
KoryKramer
Esri Community Moderator

Is all of the formatting consistent in the Excel fields?

Formatting a table in Microsoft Excel for use in ArcGIS—Help | ArcGIS Desktop