0

I have a very big dataset in a gbd. I would like to export it to an excel file. I use the following code:

startingP = r"C:\Directory\ArcGIS\By_Coding.gdb\MyInput"
endingP = r"C:\Directory\ArcGIS\By_Coding.gdb\Output.xls"
arcpy.TableToExcel_conversion (startingP,endingP)

But what I get is:

ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000814: Invalid file type

I have already seen in another question that it was suggested to combine arcpy.TabletoExcel_conversion with other tools like ListDatasetand with MakeTableView_managementbut it sounds weird to me that there is no faster way to do it, because I always thought the arcpy functions perfectly replicated the corresponding Arcgis toolbox tools, and if I use Arctoolbox > Conversion Tools > Excel > Excel to Table using the input file "MyInput" as "Input Table", it works. Is therefore any mistake in the way I call my variables in the code?

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Patapunfate
  • 551
  • 3
  • 12

1 Answers1

2

I think your problem is that you're trying to save your output in your geodatabase. Change endingP to:

endingP = r"C:\Directory\ArcGIS\output.xls"

And see if that works.

GISHuman
  • 3,671
  • 1
  • 20
  • 42
  • It was! Thank you a lot! I was so sure the problem was in my input file and not in the output directory, but I was focusing on the wrong problem. But why does it not accept the geodatabase as a valid output directory? – Patapunfate May 19 '16 at 16:19
  • I know that some python functions don't work well with Arc's geodatabases, they're unable to read them, so I suspect it's something similar going on here too. For example: http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-data-access/walk.htm – GISHuman May 19 '16 at 16:45