<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Problem with xlsx file conversion and creation of XY event layer in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/problem-with-xlsx-file-conversion-and-creation-of/m-p/667358#M51831</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Does this actually work in ArcGIS 10.1 SP1?&amp;nbsp; I'm all of a sudden unable to convert or export any excel files to any other format.&amp;nbsp; I've used just about every gp tool there is: TableToTable, TableTodBase, TableToGeodatabase, CopyRows.&amp;nbsp; They all give me the same error: "input data does not exist or is not supported"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have you run into this problem?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 08 Mar 2013 15:43:36 GMT</pubDate>
    <dc:creator>NilsBabel</dc:creator>
    <dc:date>2013-03-08T15:43:36Z</dc:date>
    <item>
      <title>Problem with xlsx file conversion and creation of XY event layer</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-xlsx-file-conversion-and-creation-of/m-p/667356#M51829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a bunch of xlsx files with XY data for health care facilities. As an exercise to learn python better, I'm trying to (1) convert the xlsx files to dBase files, (2) create an event layer from the dBase files using the XY attribute fields, and (3) copy the event layers to shp files. Any help would be greatly appreciated. My code is bellow (note: all xlsx files have a single sheet called 1. The XY data in the xlsx files are in fields/columns POINT_X and POINT_Y.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;

import arcpy, os, sys, traceback

arcpy.env.workspace = 'D:\\AG_Vet\\ForImportGDB\\'
outPath = 'D:\\AG_Vet\\ForImportGDB\\Output\\'

# Local variables

xVal = "POINT_X"
yVal = "POINT_Y"

# Factory code for NAD 1983
factory_code_CS = 4269

sr = arcpy.SpatialReference()
sr.factoryCode = factory_code_CS
sr.create()

# List all files in folder then list all tables in file
fileList = arcpy.ListFiles("*.xlsx")
print 'Listing .xlsx files in workspace'

try:

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Loop through each file
&amp;nbsp;&amp;nbsp;&amp;nbsp; for file in fileList:

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Use splitext to set the output name of the table
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbfFile = os.path.splitext(file)[0] + ".xlsx"

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Convert excel to DBF
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.TableToTable_conversion(file, outPath, dbfFile+ ".dbf")

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'File conversion. Converted ' + file

&amp;nbsp;&amp;nbsp;&amp;nbsp; #List dBase tables
&amp;nbsp;&amp;nbsp;&amp;nbsp; tableList = arcpy.ListTables('',dBase)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print ' List dBase tables in workspace'

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Loop through each table
&amp;nbsp;&amp;nbsp;&amp;nbsp; for table in tableList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Make XY event layer
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeXYEventLayer_management(table, xVal, yVal, "points_" + table, sr)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Save output
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management("points_"+table, outpath + table)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Created XY shp file for ' + table

&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Script complete.'


except:

&amp;nbsp;&amp;nbsp;&amp;nbsp; tb = sys.exc_info()[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp; tbinfo = traceback.format_tb(tb)[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; pymsg = "PYTHON ERRORS:\nTraceback Info:\n" + tbinfo + "\nError Info:\n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; " +&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; str(sys.exc_type) + ": " + str(sys.exc_value) + "\n"
&amp;nbsp;&amp;nbsp;&amp;nbsp; msgs = "ARCPY ERRORS:\n" + arcpy.GetMessages(2) + "\n"

&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddError(msgs)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddError(pymsg)

&amp;nbsp;&amp;nbsp;&amp;nbsp; print msgs
&amp;nbsp;&amp;nbsp;&amp;nbsp; print pymsg
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(arcpy.GetMessages(1))
&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetMessages(1)

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 19:54:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-xlsx-file-conversion-and-creation-of/m-p/667356#M51829</guid>
      <dc:creator>EricSchultheis</dc:creator>
      <dc:date>2012-02-28T19:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with xlsx file conversion and creation of XY event layer</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-xlsx-file-conversion-and-creation-of/m-p/667357#M51830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You were very close, just a few workspace issues (you need to change the workspace to the actual .xlsx file to access the sheet, then back to the folder level to export the table and create the shapefile) and a couple small things. Give this a try, changing to your paths of course.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os, sys, traceback

arcpy.env.workspace = r"C:\GIS\xlsxTest"
outPath = r"C:\GIS\xlsxTest\output"
arcpy.env.overwriteOutput = True

# Local variables

xVal = "POINT_X"
yVal = "POINT_Y"

# Factory code for NAD 1983
factory_code_CS = 4269

sr = arcpy.SpatialReference()
sr.factoryCode = factory_code_CS
sr.create()

# List all files in folder then list all tables in file
fileList = arcpy.ListFiles("*.xlsx")
print 'Listing .xlsx files in workspace'

try:

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Loop through each file
&amp;nbsp;&amp;nbsp;&amp;nbsp; for file in fileList:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print file
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = os.path.join(r"C:\GIS\xlsxTest", file)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Use splitext to set the output name of the table
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbfFile = os.path.splitext(file)[0] #+ ".xlsx"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if arcpy.Exists(dbfFile+".dbf"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "deleting"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(dbfFile+".dbf")

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Convert excel to DBF
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.TableToTable_conversion("Sheet1$", outPath, dbfFile+ ".dbf")
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'File conversion. Converted ' + file

&amp;nbsp;&amp;nbsp;&amp;nbsp; #List dBase tables
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = outPath
&amp;nbsp;&amp;nbsp;&amp;nbsp; tableList = arcpy.ListTables("", "dBASE")
&amp;nbsp;&amp;nbsp;&amp;nbsp; print ' List dBase tables in workspace'

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Loop through each table
&amp;nbsp;&amp;nbsp;&amp;nbsp; for table in tableList:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print table
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Make XY event layer
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeXYEventLayer_management(table, xVal, yVal, "points_" + table, sr)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Save output
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.FeatureClassToShapefile_conversion("points_"+table, outPath)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Created XY shp file for ' + table

&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Script complete.'


except:

&amp;nbsp;&amp;nbsp;&amp;nbsp; tb = sys.exc_info()[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp; tbinfo = traceback.format_tb(tb)[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; pymsg = "PYTHON ERRORS:\nTraceback Info:\n" + tbinfo + "\nError Info:\n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; " +&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; str(sys.exc_type) + ": " + str(sys.exc_value) + "\n"
&amp;nbsp;&amp;nbsp;&amp;nbsp; msgs = "ARCPY ERRORS:\n" + arcpy.GetMessages(2) + "\n"

&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddError(msgs)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddError(pymsg)

&amp;nbsp;&amp;nbsp;&amp;nbsp; print msgs
&amp;nbsp;&amp;nbsp;&amp;nbsp; print pymsg
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(arcpy.GetMessages(1))
&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetMessages(1)
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:12:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-xlsx-file-conversion-and-creation-of/m-p/667357#M51830</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-12T04:12:22Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with xlsx file conversion and creation of XY event layer</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-xlsx-file-conversion-and-creation-of/m-p/667358#M51831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Does this actually work in ArcGIS 10.1 SP1?&amp;nbsp; I'm all of a sudden unable to convert or export any excel files to any other format.&amp;nbsp; I've used just about every gp tool there is: TableToTable, TableTodBase, TableToGeodatabase, CopyRows.&amp;nbsp; They all give me the same error: "input data does not exist or is not supported"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have you run into this problem?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Mar 2013 15:43:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-xlsx-file-conversion-and-creation-of/m-p/667358#M51831</guid>
      <dc:creator>NilsBabel</dc:creator>
      <dc:date>2013-03-08T15:43:36Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with xlsx file conversion and creation of XY event layer</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-xlsx-file-conversion-and-creation-of/m-p/667359#M51832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sounds like you might be using 64bit Background Processing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Excel as an input data type isn't supported there.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you have it installed, I'd give a quick read of &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/#/Background_Geoprocessing_64_bit/002100000040000000/"&gt;http://resources.arcgis.com/en/help/main/10.1/#/Background_Geoprocessing_64_bit/002100000040000000/&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Mar 2013 15:49:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-xlsx-file-conversion-and-creation-of/m-p/667359#M51832</guid>
      <dc:creator>KevinHibma</dc:creator>
      <dc:date>2013-03-08T15:49:27Z</dc:date>
    </item>
  </channel>
</rss>

