Skip to main content
1 of 5

After hiding a field, Table to Excel gives RuntimeError Cannot find field ''

I'm trying to export a Table View to Excel (using arcpy). It works well if the Table View doesn't have hidden fields. As soon as I hide the OBJECTID when creating the View, I get a runtime error (Cannot find field '').

When I try to do the same in the ModelBuilder, it works. Any idea why the Python script fails to execute?

arcpy.MakeTableView_management(TEMP_Consumption, TEMP_Consumption_View, "", "", "OBJECTID OBJECTID HIDDEN NONE;Customer_Name Customer_Name VISIBLE NONE")
arcpy.TableToExcel_conversion(TEMP_Consumption_View, ExportFile, "ALIAS", "CODE")