AnsweredAssumed Answered

Simple table to excel conversion in Python

Question asked by on Aug 13, 2018
Latest reply on Aug 21, 2018 by

Good day everyone,


I've used the table to excel tool in model builder but now I want to have it in a form of a python script. Using the ESRI Table to Excel Help paged and I ended up with this.



     # Run the Intersect analysis
    Input_Table = arcpy.Intersect_analysis([IntersectFeature, AreaOfInterest], SpecifiedSites, "ALL", "", "INPUT")
    # Report a success message   
    arcpy.AddMessage("Intersect analysis made!")
    #Process: Export to CSV table
    arcpy.TableToExcel_conversion(Input_Table, wrk+"\Ouput_Excel_File.xls", "NAME", "CODE")
    # Report a success message   
    arcpy.AddMessage("Results exported to a Excel file!")


The intersect analysis works fine but the conversion failed to execute.  Here's the specific error message:


Running script TableToExcel...

Failed script TableToExcel...


Traceback (most recent call last):

File "c:\program files (x86)\arcgis\desktop10.2\ArcToolbox\Scripts\", line 222, in <module>


File "c:\program files (x86)\arcgis\desktop10.2\ArcToolbox\Scripts\", line 216, in table_to_excel

File "C:\Python27\ArcGIS10.2\lib\site-packages\xlwt\", line 662, in save, self.get_biff_data())

File "C:\Python27\ArcGIS10.2\lib\site-packages\xlwt\", line 261, in save

f = open(file_name_or_filelike_obj, 'w+b')

IOError: [Errno 2] No such file or directory: u'C:\\Users\\pierrej\\Desktop\\GISData\\Ouput_Excel_File.xls'