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?

3
  • save it to your desktop or somewhere else besides the GDB and it should work
    – ziggy
    May 19 '16 at 16:15
  • Thank you that was indeed the problem, but why python does not like the gdb as output directory? May 19 '16 at 16:22
  • when you used the tool from arctoolbox were you able to save the .xls into your GDB?
    – ziggy
    May 19 '16 at 16:38
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.

2
  • 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? 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: desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-data-access/…
    – GISHuman
    May 19 '16 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.