Saving XYEvent to Feature Class

Discussion created by tmcconnell on Jun 27, 2014
Latest reply on Jun 30, 2014 by rfairhur24
I have been trying to create an XY Event file from an Excel 2007 table, then preserve it as a FC in a file geodatabase.  The XY event seems to be created properly, but the Copy Features tool blows up with Error 99999.  Code follows, with error message:
# ---------------------------------------------------------------------------
# ---------------------------------------------------------------------------

# Import arcpy module
import arcpy
from arcpy import env

# Set overwrite option
arcpy.env.overwriteOutput = True

# Local variables:
R20060102 = "C:\\Ameet\\Climate\\Tables\\R20060102.xlsx\\R20060102$"
X_Field = "long"
Y_Field = "lat"
Spatial_Reference = "GEOGCS['GCS_Arc_1960',DATUM['D_Arc_1960',SPHEROID['Clarke_1880_RGS',6378249.145,293.465]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]];-400 -400 1000000000;-100000 10000;-100000 10000;8.98299489570697E-09;0.001;0.001;IsHighPrecision"
R20060102Layer = "R20060102Layer"
R20060102Lyr = "C:\\Ameet\\Climate\\R20060102.lyr"
R20060102FC = "C:\\Ameet\\Climate\\Daily.gdb\\R20060102"

# Process: Make XY Event Layer
#MakeXYEventLayer_management (table, in_x_field, in_y_field, out_layer, {spatial_reference}, {in_z_field})
arcpy.MakeXYEventLayer_management(R20060102, X_Field, Y_Field, R20060102Layer, Spatial_Reference, "")
print "Event created"

# Process: Save To Layer File
#SaveToLayerFile_management (in_layer, out_layer, {is_relative_path}, {version})
#arcpy.SaveToLayerFile_management(R20060102Layer, R20060102Lyr)
#print "Layer created"

#CopyFeatures_management (in_features, out_feature_class, {config_keyword}, {spatial_grid_1}, {spatial_grid_2}, {spatial_grid_3})
arcpy.CopyFeatures_management(R20060102Lyr, R20060102FC)
print "New FC created"

Executing: CopyFeatures C:\Ameet\Climate\R20060102.lyr C:\Ameet\Climate\Daily.gdb\R20060102 # 0 0 0
Start Time: Fri Jun 27 01:51:44 2014
ERROR 999999: Error executing function.
The XY event source name has not been setup correctly.
Failed to execute (CopyFeatures).
Failed at Fri Jun 27 01:51:45 2014 (Elapsed Time: 0.53 seconds)