I'm having trouble specifying field aliases in an excel file I created using arcpy.TableToExcel. I've specified "ALIAS" but it seems to ignore it. The field aliases are set within the database. Can anyone help me with what I'm doing wrong? Or give me another method?
Thanks,
Brandon
import arcpy defeatureclasspath = r"C:\Users\bkeinath\AppData\Roaming\ESRI\Desktop10.2\ArcCatalog\PGISA2_gisadm.sde\GISADM.DistributedEnergy" arcpy.MakeQueryTable_management(defeatureclasspath,\ "CompletedProjectView",\ "USE_KEY_FIELDS",\ "OBJECTID",\ "CUSTOMERLASTNAME; ACCOUNTNUMBER; PROJECTIDENTIFIER; SYSTEMSIZE; CUSTOMERMAILINGADDRESS; PUCPREID; PUCFINALID; APPLICATIONDATE; ACTUALONLINEDATE") #Create excel file from CompletedProjectView arcpy.TableToExcel_conversion("CompletedProjectView", r"E:\temp\CompletedProjects.xls", "ALIAS")
Solved! Go to Solution.
Hi Randy,
When I ran the TableToExcel tool on the feature class it said it couldn't open the feature class. I then took your suggestion about the file geotabase and after exporting it to a new feature class in a .gdb the excel file contains the aliases. Woohoo! Thank you for your help.
We use an Oracle SDE. I don't see anything in the esri documentation about this being a known limitation so I'll submit a ticket to see if there is something special I'm missing. I'll try to post back here for others using SDE. For now my workflow will be to create a new file geodatabase, import the data, and execute my code on this new feature class.
Best,
Brandon