Add alias when creating shapefiles

04-29-2022 08:56 AM
New Contributor

Hello all. I am using Python 3 and ArcGIS Pro 2.9.

I have written a script to create shape files from an excel workbook and append them to an existing shape file. However, some of the column names from the excel are cut off in the attribute table of the shape files (ex. Document_Name becomes Document_N). Is this because they're too long?

If there is a way to keep the entire column name from the excel, that would be ideal. I have tried adding an alias after the shape files have been created.

I used the management.AlterField() tool but am receiving ERROR 000664. I'm guessing this tool doesn't work with shape files and only feature classes, etc according to the documentation.

I was wondering if there was a way to add alias names during the creation of the shape files themselves, or any other way to add an alias.

Below is the code I have tried using to add aliases to the attribute table. I plan on adding this piece to the larger script once it is figured out. If that is needed for more context, let me know. Thank you in advance for your help!




0 Kudos
2 Replies
MVP Esteemed Contributor

The field names have limitations for sure... see

Geoprocessing considerations for shapefile output—ArcGIS Pro | Documentation

You could document a text file with python and with notable information and just save it with the shapefilename with a .txt file extension to keep information together if you need to use them

... sort of retired...
0 Kudos
New Contributor

After reading the documentation you provided, I think I will go back to trying to create a feature class in a gdb instead. I was trying shape files because I kept running into the problem of the shemas not matching when  appending to a feature class. Thank you for your reply.

0 Kudos