1

I am trying to create a point FeatureClass from an Excel-File using a standalone python-script. I am applying the method "arcpy.MakeXYEventLayer()" which works fine using *.xlsx files. However, I am having problems using *xls files. It also works for *.xls files using the python-window in ArcGIS directly, but not in my standalone script.

For my script I get this error:

ERROR 000732: XY Table: Dataset C:...\data_for_GIS.xls\sheet1$ does not exist or is not supported

Any suggestions?

Here is the code:

import arcpy
import os

arcpy.env.overwriteoutput = True

folder = r"C:/..."
excelfile = "Test.xls"
coordsystem = "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.env.workspace = folder

table = "sheet1"
intable = folder + os.sep + excelfile + os.sep + table + "$"


arcpy.MakeXYEventLayer_management(intable,"GEOLON","GEOLAT","LAYER",coordsystem)
14
  • 2
    @Vince the trailing dollar sign is actually necessary for loading excelfiles into ArcGIS
    – Alex
    Commented Jan 13, 2016 at 12:33
  • 1
    I would first convert the Excel sheet to a table, using the Excel Toolset, Excel to Table.
    – klewis
    Commented Jan 13, 2016 at 14:15
  • 1
    Are you trying to run from 64bit Background geoprocessing? I've found that trying to open XLS files from 64bit arcpy usually gives that message. Try running from 32bit python.
    – Midavalo
    Commented Jan 14, 2016 at 6:32
  • 1
    Oops, wrong link, I meant to suggest that you try the Excel to table tool mentioned in this answer: gis.stackexchange.com/a/68764/59 Commented Jan 14, 2016 at 17:09
  • 1
    @Alex how are you running your python? From the command line, or via other software? If from the command line you may just need to switch to the 32bit python folder for your python.exe (I have both installed, one in c:\python27\arcgis10.3\ and the other in c:\python27\arcgisx64\10.3)
    – Midavalo
    Commented Jan 14, 2016 at 23:17

1 Answer 1

0

Well, as far as we got now, I would say that it is a bug. I am still confused a bit as it works in the python window with *.xls files and *.xlsx files, but not using a stand alone script. I solved the problem now, as I import the data from the *.xls file to python using xlrd and export it to a *.xlsx file using xlsxwriter. Maybe not the smartest work around, but it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.