I need to convert a .xls file to a point shapefile. The Excel file contains points in Lat, Lon with many attribute fields. I wrote this script to convert from .xls to .dbf and then to shapefile but it creates a .dbf of strings instead of numbers.
How can I fix this?
import os
import glob
import arcpy
from arcpy import env
arcpy.env.overwriteOutput = True
env.workspace = r"E:\test"
os.chdir(r"E:\test")
xlslist = arcpy.ListFiles("*.xls")
for xlsfile in xlslist:
InFile = xlsfile
outFile = os.path.splitext(InFile)[0]+".dbf"
arcpy.ExcelToTable_conversion(InFile, outFile, Sheet="Sheet")
outlayer = outFile
outlayer = os.path.splitext(InFile)[0]+"_Layer"
spatialreference = "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]];-400 -400 1000000000;-100000 10000;-100000 10000;8.98315284119522E-09;0.001;0.001;IsHighPrecision"
arcpy.MakeXYEventLayer_management(outFile,"Longitude","Latitude",outlayer,spatialreference,"#")
shpfile = os.path.splitext(xlsfile)[0]
arcpy.CopyFeatures_management(outlayer,shpfile)
del outlayer