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 ListDataset
and with MakeTableView_management
but 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?
-
save it to your desktop or somewhere else besides the GDB and it should workziggy– ziggy2016年05月19日 16:15:09 +00:00Commented May 19, 2016 at 16:15
-
Thank you that was indeed the problem, but why python does not like the gdb as output directory?Patapunfate– Patapunfate2016年05月19日 16:22:08 +00:00Commented May 19, 2016 at 16:22
-
when you used the tool from arctoolbox were you able to save the .xls into your GDB?ziggy– ziggy2016年05月19日 16:38:32 +00:00Commented May 19, 2016 at 16:38
1 Answer 1
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.
-
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– Patapunfate2016年05月19日 16:19:34 +00:00Commented May 19, 2016 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– GISHuman2016年05月19日 16:45:19 +00:00Commented May 19, 2016 at 16:45
Explore related questions
See similar questions with these tags.