Select a table to use when calling TableToExcel()

542
1
11-30-2016 02:57 PM
VincentFuller
New Contributor

How can I get the current open table names in ArcGIS to use with the TableToExcel() function? Its not easy to find. This is the current table that is visible when im using the gui.

Thank you,

V

0 Kudos
1 Reply
JoshuaBixby
MVP Esteemed Contributor

If you only want table tables, and not feature class tables, that are loaded into an ArcGIS Pro project:

aprx = arcpy.mp.ArcGISProject("CURRENT")
table_names = [table.name for map in aprx.listMaps() for table in map.listTables()]‍‍‍‍‍‍‍‍

Although the code above will create a list of table names, having a list of table names or Table objects still doesn't fully address the issue, at least within the interactive Python window.  The interactive Python window in ArcGIS Pro appears to be scoped within Maps so passing the table name from another Map will generate an error.  I hadn't run into this issue before, somewhat surprisingly, so I will have to dig into it a bit more.

0 Kudos