arcpy.ExcelToTable field name length limitation for in_memory output

696
5
Jump to solution
11-07-2017 10:30 AM
MaximeDemers
Occasional Contributor III

I found out there is a limitation of 10 characters for field names if you output arcpy.ExcelToTable() to a "in_memory" table.

Why? Is it because dbf format is used?

I dont have this limitation when I use "in_memory" with other tools such arcpy.CopyFeatures_management().

arcpy.ExcelToTable_conversion("C:\\temp\\input.xlsx", "in_memory\table")

Is there a way to use get rid of this limitation with arcpy.ExcelToTable() and "in_memory"?

0 Kudos
1 Solution

Accepted Solutions
MaximeDemers
Occasional Contributor III

It appears there is not that limitation when using arcpy.TableToTable_conversion() instead of arcpy.ExcelToTable() but .xlsx is not supported. You will have to use .xls or other formats.

arcpy.TableToTable_conversion("c:\\temp\\input.xls", "in_memory", "table")‍‍‍

View solution in original post

5 Replies
DanPatterson_Retired
MVP Esteemed Contributor

Try adding a ValidateFieldName to your workflow to see what it returns since it validates it against the workspace and not the source.  So for geodatabase, it would be longer, but in_memory or folder, there is no recommendation, but a shapefile would definitely have a limitation... see this also

http://pro.arcgis.com/en/pro-app/arcpy/get-started/working-with-geodatabases.htm

MaximeDemers
Occasional Contributor III

It appears there is not that limitation when using arcpy.TableToTable_conversion() instead of arcpy.ExcelToTable() but .xlsx is not supported. You will have to use .xls or other formats.

arcpy.TableToTable_conversion("c:\\temp\\input.xls", "in_memory", "table")‍‍‍
DanPatterson_Retired
MVP Esteemed Contributor

If the table is going out to a geodatabase table, but not a dbase table I would assume from the help

http://pro.arcgis.com/en/pro-app/tool-reference/conversion/table-to-table.htm

curtvprice
MVP Esteemed Contributor

I really try to avoid long field names unless I absolutely need them, because if the dataset has to go through shapefile at some point (say to export to another software system) your field names will get truncated. 

Geoprocessing considerations for shapefile output—Help | ArcGIS Desktop 

MaximeDemers
Occasional Contributor III

Good advice, but I prefer to avoid shapefiles, JSON is a better format for sharing data between systems, especially over the net because it's a one file format and can be manipulated by almost every programming language directly.