Hello everybody,
I'm new in this world of arcpy and I would like poder export all of layer of a gbd to an excel format, I tried with several this foro's scripts but I can't get the result, this is my script actual but not funcionate.
import arcpy
from arcpy import env
env.workspace = r" C:\Users\LAP77\Desktop\JR\Veg_Hidro_Final.gdb"
output_folder = of = r" C:\Users\LAP77\Desktop\JR\Veg_Hidro_Final\Excel"
for fc in arcpy.ListFeatureClasses("*"):
fc_name= of+ "\\"+fc+".xls"
print(fc_name)
arcpy.TableToExcel_conversion(fc,fc_name, "NAME", "CODE")
Solved! Go to Solution.
try printing the "fc" name as well to make sure it exists and that it is a geodatabase table.
You just printed the output xls name.
spaces in the path.... isn't a path if it is the first character especially
raw encoding won't help for that either
Thanks for your time, and I'm sorry for not verified the spaces.
import os
import arcpy
from arcpy import env
env.workspace = r"C:\data.gdb"
output_folder = r"C:\output"
for fc in arcpy.ListFeatureClasses("*"):
out_xls = os.path.join(output_folder, r'{}.xls'.format(fc))
env.overwriteOutput = True
fc_path = os.path.join(env.workspace, fc)
fc_table_view = arcpy.MakeTableView_management(fc_path, "tview")
arcpy.TableToExcel_conversion(fc_table_view, out_xls)