<?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: How to convert excel to csv? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-convert-excel-to-csv/m-p/54412#M4293</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'll be fairly brief in my comments here...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;First of all, in what I'll call the 'main' script you posted, you are missing lines importing other modules/scripts this main script depends on:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import os&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import csv&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import domainvalues&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...and with that, let's pay particular attention to the last line of that import set (you already have ArcGIS 10.0, correct?...in other words, the ability to import arcpy??).&amp;nbsp; That line imports a 'helper' py file called domainvalues (which you should have downloaded with this package, contained in the 'scripts' folder) and this should handle converting any db domain descriptor values you have defined (if converting a db table).&amp;nbsp; This script has to be in a python-recognizable location, so provided you have a default install, you could place the domainvalues.py in this common library location for '3rd party modules':&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;C:\Python\Lib\site-packages\&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;About that convention on lib files, you can read more here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://docs.python.org/2/using/windows.html#finding-modules" rel="nofollow noopener noreferrer" target="_blank"&gt;http://docs.python.org/2/using/windows.html#finding-modules&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also in the download, there's a tbx that likely contains an already 'wired' tool interface (check this out in your download) -- I strongly recommend you implement that so that you can call this as a script tool.&amp;nbsp; I think you should be able to then use the script unaltered - you may have to 'wire' the script to this toolbox interface but that is easy via ArcToolbox (or Catalog in ArcMap).&amp;nbsp; If the script tool has been saved with relative paths, you may only need to run the tool through your toolbox interface from your download location (the one you unzipped to).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Having said all that, you can make this run without arcpy or domainvalues - but this was written to leverage your ArcGIS install, so why cripple it, working out a different hack when it appears your problem seems to be only with install details?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope that helps,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...one more FYI:&amp;nbsp; enclose all code in tags-- use the hash tool on the toolbar, or type  &lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;after&lt;/SPAN&gt;&lt;SPAN&gt; the code and &lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; &lt;SPAN style="text-decoration:underline;"&gt;before&lt;/SPAN&gt; the code.&amp;nbsp; So this would be the actual priginally published py code from earlier in this thread, part of the package you downloaded:
&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
"""
&amp;nbsp;&amp;nbsp; This script will convert a table to a .csv file. It will transfer domain
&amp;nbsp;&amp;nbsp; descriptions, rather than just their coded values
"""
import arcpy
import os
import csv
import domainvalues


def export_to_csv(dataset, output, dialect):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """Output the data to a CSV file"""
&amp;nbsp;&amp;nbsp;&amp;nbsp; # create the output writer
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_writer = csv.writer(open(output, 'wb'), dialect=dialect)
&amp;nbsp;&amp;nbsp;&amp;nbsp; # return the list of field names and field values
&amp;nbsp;&amp;nbsp;&amp;nbsp; header, rows = domainvalues.header_and_iterator(dataset)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # write the field names and values to the csv file
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_writer.writerow(map(domainvalues._encodeHeader, header))
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; out_writer.writerow(map(domainvalues._encode, row))

if __name__ == "__main__":
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Get parameters
&amp;nbsp;&amp;nbsp;&amp;nbsp; dataset_name = arcpy.GetParameterAsText(0)
&amp;nbsp;&amp;nbsp;&amp;nbsp; output_file = arcpy.GetParameterAsText(1)
&amp;nbsp;&amp;nbsp;&amp;nbsp; delim = arcpy.GetParameterAsText(2).lower()
&amp;nbsp;&amp;nbsp;&amp;nbsp; dialect = 'excel'
&amp;nbsp;&amp;nbsp;&amp;nbsp; if delim == 'comma':
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dialect = 'excel-tab'
&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; export_to_csv(dataset_name, output_file, dialect)
&amp;nbsp;&amp;nbsp;&amp;nbsp; except Exception as err:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddError('Error: {0}'.format(err))
&lt;/PRE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 22:04:46 GMT</pubDate>
    <dc:creator>T__WayneWhitley</dc:creator>
    <dc:date>2021-12-10T22:04:46Z</dc:date>
    <item>
      <title>How to convert excel to csv?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-convert-excel-to-csv/m-p/54405#M4286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I been looking for the code to convert an excel into a csv? I also look in ArcHelp for code that can convert excel into a xy event&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;but they require csv. So, if I there no way to convert the code to a csv is there a way to make an excell file into a xy event?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jul 2013 18:27:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-convert-excel-to-csv/m-p/54405#M4286</guid>
      <dc:creator>LeroneSavage</dc:creator>
      <dc:date>2013-07-19T18:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert excel to csv?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-convert-excel-to-csv/m-p/54406#M4287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Arcmap will read an excel worksheet and you can create an event theme based on coordinates stored in the file. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Right out of the help:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//005s0000001w000000"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//005s0000001w000000&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jul 2013 18:45:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-convert-excel-to-csv/m-p/54406#M4287</guid>
      <dc:creator>JimCousins</dc:creator>
      <dc:date>2013-07-19T18:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert excel to csv?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-convert-excel-to-csv/m-p/54407#M4288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I know that. But I am looking for the&amp;nbsp; python code that does the conversion. Thnx.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jul 2013 20:20:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-convert-excel-to-csv/m-p/54407#M4288</guid>
      <dc:creator>LeroneSavage</dc:creator>
      <dc:date>2013-07-19T20:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert excel to csv?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-convert-excel-to-csv/m-p/54408#M4289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There's also a &lt;/SPAN&gt;&lt;A href="http://www.arcgis.com/home/item.html?id=f3d91b8f852042e289e09a7ec8342431"&gt;tool to convert between&lt;/A&gt;&lt;SPAN&gt; tables, excel and csv. You can add it to a model, or adapt the code in your own scripts, or just use it on it's own. Very handy.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jul 2013 20:39:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-convert-excel-to-csv/m-p/54408#M4289</guid>
      <dc:creator>Zeke</dc:creator>
      <dc:date>2013-07-19T20:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert excel to csv?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-convert-excel-to-csv/m-p/54409#M4290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can control Excel from Python using win32com.client.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import win32com.client

xlApp = win32com.client.Dispatch("Excel.Application") #Open Excel
xlWb = xlApp.Workbooks.Open(PATH_TO_WORKBOOK) #Open a workbook - change the path
xlApp.ActiveWorkbook.SaveAs(PATH_TO_NEW_CSV_FILE, FileFormat=24) #Save to csv - FileFormat=24 means .csv
xlApp.ActiveWorkbook.Close(SaveChanges=0) #Close Workbook
xlApp.Quit() #Close Excel
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:04:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-convert-excel-to-csv/m-p/54409#M4290</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2021-12-10T22:04:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert excel to csv?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-convert-excel-to-csv/m-p/54410#M4291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;There's also a &lt;A href="http://www.arcgis.com/home/item.html?id=f3d91b8f852042e289e09a7ec8342431"&gt;tool to convert between&lt;/A&gt; tables, excel and csv. You can add it to a model, or adapt the code in your own scripts, or just use it on it's own. Very handy.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I download the tool. But there is no documentation for the arguments. Do you happen to know them? Thanks in advance for your consideration.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# convert .dbfs to CSV&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;def export_to_csv(dataset, output, dialect):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; """Output the data to a CSV file"""&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # create the output writer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; out_writer = csv.writer(open(output, 'wb'), dialect=dialect)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # return the list of field names and field values&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; header, rows = domainvalues.header_and_iterator(dataset)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # write the field names and values to the csv file&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; out_writer.writerow(map(domainvalues._encodeHeader, header))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; out_writer.writerow(map(domainvalues._encode, row))&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if __name__ == "__main__":&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Get parameters&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dataset_name = arcpy.GetParameterAsText(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output_file = arcpy.GetParameterAsText(1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; delim = arcpy.GetParameterAsText(2).lower()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dialect = 'excel'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if delim == 'comma':&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dialect = 'excel-tab'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; export_to_csv(dataset_name, output_file, dialect)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; except Exception as err:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddError('Error: {0}'.format(err))&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;dataset = outLocation+"Nearness.dbf" # what goes here?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;output = "Nearness" # same from above&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dialect = # not sure what goes here?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# function call&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;export_to_csv(dataset, output, dialect)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#print "Convered .dbfs into CSVs"&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 28 Jul 2013 11:11:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-convert-excel-to-csv/m-p/54410#M4291</guid>
      <dc:creator>LeroneSavage</dc:creator>
      <dc:date>2013-07-28T11:11:09Z</dc:date>
    </item>
    <item>
      <title>Help understanding the argments for a TableToCSV function</title>
      <link>https://community.esri.com/t5/python-questions/how-to-convert-excel-to-csv/m-p/54411#M4292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I download the tool that had this function that converts .dbf to csv. But there is no documentation for how to implement the arguments of the tool. Do you happen to know to do so? Thanks in advance for your consideration.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# convert .dbfs to CSV&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;def export_to_csv(dataset, output, dialect):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"""Output the data to a CSV file"""&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# create the output writer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;out_writer = csv.writer(open(output, 'wb'), dialect=dialect)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# return the list of field names and field values&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;header, rows = domainvalues.header_and_iterator(dataset)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# write the field names and values to the csv file&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;out_writer.writerow(map(domainvalues._encodeHeader, header))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for row in rows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;out_writer.writerow(map(domainvalues._encode, row))&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if __name__ == "__main__":&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Get parameters&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dataset_name = arcpy.GetParameterAsText(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;output_file = arcpy.GetParameterAsText(1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;delim = arcpy.GetParameterAsText(2).lower()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dialect = 'excel'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if delim == 'comma':&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pass&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dialect = 'excel-tab'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;export_to_csv(dataset_name, output_file, dialect)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;except Exception as err:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.AddError('Error: {0}'.format(err))&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;dataset =&amp;nbsp; # what goes here?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;output = " # not sure what goes here&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dialect = # same as above&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# function call&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;export_to_csv(dataset, output, dialect)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#print "Convered .dbfs into CSVs"&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 28 Jul 2013 11:15:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-convert-excel-to-csv/m-p/54411#M4292</guid>
      <dc:creator>LeroneSavage</dc:creator>
      <dc:date>2013-07-28T11:15:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert excel to csv?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-convert-excel-to-csv/m-p/54412#M4293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'll be fairly brief in my comments here...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;First of all, in what I'll call the 'main' script you posted, you are missing lines importing other modules/scripts this main script depends on:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import os&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import csv&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import domainvalues&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...and with that, let's pay particular attention to the last line of that import set (you already have ArcGIS 10.0, correct?...in other words, the ability to import arcpy??).&amp;nbsp; That line imports a 'helper' py file called domainvalues (which you should have downloaded with this package, contained in the 'scripts' folder) and this should handle converting any db domain descriptor values you have defined (if converting a db table).&amp;nbsp; This script has to be in a python-recognizable location, so provided you have a default install, you could place the domainvalues.py in this common library location for '3rd party modules':&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;C:\Python\Lib\site-packages\&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;About that convention on lib files, you can read more here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://docs.python.org/2/using/windows.html#finding-modules" rel="nofollow noopener noreferrer" target="_blank"&gt;http://docs.python.org/2/using/windows.html#finding-modules&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also in the download, there's a tbx that likely contains an already 'wired' tool interface (check this out in your download) -- I strongly recommend you implement that so that you can call this as a script tool.&amp;nbsp; I think you should be able to then use the script unaltered - you may have to 'wire' the script to this toolbox interface but that is easy via ArcToolbox (or Catalog in ArcMap).&amp;nbsp; If the script tool has been saved with relative paths, you may only need to run the tool through your toolbox interface from your download location (the one you unzipped to).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Having said all that, you can make this run without arcpy or domainvalues - but this was written to leverage your ArcGIS install, so why cripple it, working out a different hack when it appears your problem seems to be only with install details?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope that helps,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...one more FYI:&amp;nbsp; enclose all code in tags-- use the hash tool on the toolbar, or type  &lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;after&lt;/SPAN&gt;&lt;SPAN&gt; the code and &lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; &lt;SPAN style="text-decoration:underline;"&gt;before&lt;/SPAN&gt; the code.&amp;nbsp; So this would be the actual priginally published py code from earlier in this thread, part of the package you downloaded:
&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
"""
&amp;nbsp;&amp;nbsp; This script will convert a table to a .csv file. It will transfer domain
&amp;nbsp;&amp;nbsp; descriptions, rather than just their coded values
"""
import arcpy
import os
import csv
import domainvalues


def export_to_csv(dataset, output, dialect):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """Output the data to a CSV file"""
&amp;nbsp;&amp;nbsp;&amp;nbsp; # create the output writer
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_writer = csv.writer(open(output, 'wb'), dialect=dialect)
&amp;nbsp;&amp;nbsp;&amp;nbsp; # return the list of field names and field values
&amp;nbsp;&amp;nbsp;&amp;nbsp; header, rows = domainvalues.header_and_iterator(dataset)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # write the field names and values to the csv file
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_writer.writerow(map(domainvalues._encodeHeader, header))
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; out_writer.writerow(map(domainvalues._encode, row))

if __name__ == "__main__":
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Get parameters
&amp;nbsp;&amp;nbsp;&amp;nbsp; dataset_name = arcpy.GetParameterAsText(0)
&amp;nbsp;&amp;nbsp;&amp;nbsp; output_file = arcpy.GetParameterAsText(1)
&amp;nbsp;&amp;nbsp;&amp;nbsp; delim = arcpy.GetParameterAsText(2).lower()
&amp;nbsp;&amp;nbsp;&amp;nbsp; dialect = 'excel'
&amp;nbsp;&amp;nbsp;&amp;nbsp; if delim == 'comma':
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dialect = 'excel-tab'
&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; export_to_csv(dataset_name, output_file, dialect)
&amp;nbsp;&amp;nbsp;&amp;nbsp; except Exception as err:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddError('Error: {0}'.format(err))
&lt;/PRE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:04:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-convert-excel-to-csv/m-p/54412#M4293</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2021-12-10T22:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: Help understanding the argments for a TableToCSV function</title>
      <link>https://community.esri.com/t5/python-questions/how-to-convert-excel-to-csv/m-p/54413#M4294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;see your other thread:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/88874-How-to-convert-excel-to-csv"&gt;http://forums.arcgis.com/threads/88874-How-to-convert-excel-to-csv&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 28 Jul 2013 15:44:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-convert-excel-to-csv/m-p/54413#M4294</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-07-28T15:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert excel to csv?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-convert-excel-to-csv/m-p/54414#M4295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I been looking for the code to convert an excel into a csv?&lt;STRONG&gt; I also look in ArcHelp for code that can convert excel into a xy event&lt;BR /&gt;but they require csv&lt;/STRONG&gt;. So, if I there no way to convert the code to a csv is there a way to make an excell file into a xy event?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you really need a csv file, or are you just trying to create the xy event theme?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;As pointed out earlier, you can use the excel sheet as input to the create xy event theme, the do NOT require a csv.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# Import arcpy module
import arcpy


# Local variables:
Sheet1 = "D:\\Book1.xls\\Sheet1$"
Output_Location = "D:\\"
Sheet1Layer = "Sheet1$Layer"

# Process: Make XY Event Layer
arcpy.MakeXYEventLayer_management(Sheet1, "Easting", "Northing", Sheet1Layer, "", "")

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This make an even layer just fine using xls as input (docs say xlxs supported also).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:04:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-convert-excel-to-csv/m-p/54414#M4295</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2021-12-10T22:04:49Z</dc:date>
    </item>
  </channel>
</rss>

