TableToExcel_conversion gives "Dataset does not exist" error

2757
2
11-29-2015 02:59 PM
MarcelAfif
New Contributor III

I would say TableToExcel_conversion is kind of poorly documented. While the conversion toolbox allows me to manually convert [attribute tables] of a layer in my active data frame to an excel file, the documentation gives two example for which the input argument is a feature in a gdb. What I'm doing is listing all layers in my desired data frame, and calling this function on each of these layers, which is giving me the error "Dataset ... does not exist or is not supported". Note that, I can manually convert my layers to excel files using the conversion toolbox but don't want to because there's a slew of them.

Any suggestions?

Tags (1)
0 Kudos
2 Replies
DanPatterson_Retired
MVP Esteemed Contributor

Did you see the code example in ListTables—Help | ArcGIS for Desktop

This is what you want to ensure...set your workspace (ie a folder or a geodatabase), get a list of the files and them provide an appropriate filename and path using Table To Excel—Help | ArcGIS for Desktop

If you set the environment to a folder (ie c:/data/subfolder/ ) the List tables will read the files there.  If you just want to dump the excel files to there, then your task is simple.  If you want to get fancy and increase your complexity, you can change output folder, walk through a folder tree etc.  Just weigh the cost of developing such a script versus getting everything in one place then processing using a simple folder/data structure

0 Kudos
MarcelAfif
New Contributor III

I actually successfully converted .lyr files to excel files using the approach use just described, though after some researching. But what I'm looking for is how to convert layers as they appear in the Table of Contents in ArcMap, something I could do manually by using the to-excel conversion dialog.

0 Kudos