<?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: Quick export CSV w/ headers via python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/quick-export-csv-w-headers-via-python/m-p/306538#M23820</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That would be what i posted above.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a special way to copy as python snippet?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried this&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
arcpy.QuickExport_interop('S:\Tech\Greg_Mohler\pythonwork\gm_sw_py.gdb\SW_LINE CSV','S:\Tech\Greg_Mohler\pythonwork',"RUNTIME_MACROS,""APPEND,No,FIELD_NAMES,yes,SEPARATOR,"""","""",EXTENSION,csv"",META_MACROS,""DestAPPEND,No,DestFIELD_NAMES,yes,DestSEPARATOR,"""","""",DestEXTENSION,csv"",METAFILE,CSV,COORDSYS,,__FME_DATASET_IS_SOURCE__,false")
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;and I got this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
TypeError: QuickExport() takes at most 2 arguments (3 given)
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 14:40:29 GMT</pubDate>
    <dc:creator>gregmohler</dc:creator>
    <dc:date>2021-12-11T14:40:29Z</dc:date>
    <item>
      <title>Quick export CSV w/ headers via python</title>
      <link>https://community.esri.com/t5/python-questions/quick-export-csv-w-headers-via-python/m-p/306536#M23818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm looking to export a large feature class (55k+ records) to csv with headers.&amp;nbsp; Can anyone help with how to set the parameters in python?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Using Arcmap and looking in the results windows after setting parameters gives:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;CSV,S:\\Folder,"RUNTIME_MACROS,""APPEND,No,FIELD_NAMES,yes,SEPARATOR,"""","""",EXTENSION,csv"",META_MACROS,""DestAPPEND,No,DestFIELD_NAMES,yes,DestSEPARATOR,"""","""",DestEXTENSION,csv"",METAFILE,CSV,COORDSYS,,__FME_DATASET_IS_SOURCE__,false"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This gives me what i need, but I would rather not open Arcmap.&amp;nbsp; I've tried setting these items above a few ways to no avail.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I just need the input, output, and headers to be written.&amp;nbsp; From python with just input and output gives me a csv with no headers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Python 2.6 with arc10.0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for any help.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jun 2012 18:17:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/quick-export-csv-w-headers-via-python/m-p/306536#M23818</guid>
      <dc:creator>gregmohler</dc:creator>
      <dc:date>2012-06-22T18:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: Quick export CSV w/ headers via python</title>
      <link>https://community.esri.com/t5/python-questions/quick-export-csv-w-headers-via-python/m-p/306537#M23819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Right click on the result in the results window and copy as Python snippet.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jun 2012 19:02:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/quick-export-csv-w-headers-via-python/m-p/306537#M23819</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2012-06-22T19:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: Quick export CSV w/ headers via python</title>
      <link>https://community.esri.com/t5/python-questions/quick-export-csv-w-headers-via-python/m-p/306538#M23820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That would be what i posted above.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a special way to copy as python snippet?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried this&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
arcpy.QuickExport_interop('S:\Tech\Greg_Mohler\pythonwork\gm_sw_py.gdb\SW_LINE CSV','S:\Tech\Greg_Mohler\pythonwork',"RUNTIME_MACROS,""APPEND,No,FIELD_NAMES,yes,SEPARATOR,"""","""",EXTENSION,csv"",META_MACROS,""DestAPPEND,No,DestFIELD_NAMES,yes,DestSEPARATOR,"""","""",DestEXTENSION,csv"",METAFILE,CSV,COORDSYS,,__FME_DATASET_IS_SOURCE__,false")
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;and I got this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
TypeError: QuickExport() takes at most 2 arguments (3 given)
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:40:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/quick-export-csv-w-headers-via-python/m-p/306538#M23820</guid>
      <dc:creator>gregmohler</dc:creator>
      <dc:date>2021-12-11T14:40:29Z</dc:date>
    </item>
    <item>
      <title>Re: Quick export CSV w/ headers via python</title>
      <link>https://community.esri.com/t5/python-questions/quick-export-csv-w-headers-via-python/m-p/306539#M23821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I don't know about Quick Export, but this exports a feature class to csv, with headers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy, csv fc = "H:/GIS_Data/TEMP.gdb/points" #input feature class rows = arcpy.SearchCursor(fc) csvFile = csv.writer(open("H:/GIS_Data/csvfile.csv", 'wb')) #output csv fieldnames = [f.name for f in arcpy.ListFields(fc)]&amp;nbsp; allRows = [] for row in rows: &amp;nbsp;&amp;nbsp;&amp;nbsp; rowlist = [] &amp;nbsp;&amp;nbsp;&amp;nbsp; for field in fieldnames: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rowlist.append(row.getValue(field)) &amp;nbsp;&amp;nbsp;&amp;nbsp; allRows.append(rowlist) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; csvFile.writerow(fieldnames) for row in allRows: &amp;nbsp;&amp;nbsp;&amp;nbsp; csvFile.writerow(row)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;*mostly stolen from &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://forums.esri.com/Thread.asp?c=93&amp;amp;f=1729&amp;amp;t=210918" rel="nofollow" target="_blank"&gt;here&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jun 2012 20:16:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/quick-export-csv-w-headers-via-python/m-p/306539#M23821</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2012-06-22T20:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: Quick export CSV w/ headers via python</title>
      <link>https://community.esri.com/t5/python-questions/quick-export-csv-w-headers-via-python/m-p/306540#M23822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I don't know about Quick Export, but this exports a feature class to csv, with headers.&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, csv
fc = "H:/GIS_Data/TEMP.gdb/points" #input feature class
rows = arcpy.SearchCursor(fc)
csvFile = csv.writer(open("H:/GIS_Data/csvfile.csv", 'wb')) #output csv
fieldnames = [f.name for f in arcpy.ListFields(fc)]

allRows = []
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; rowlist = []
&amp;nbsp;&amp;nbsp;&amp;nbsp; for field in fieldnames:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rowlist.append(row.getValue(field))
&amp;nbsp;&amp;nbsp;&amp;nbsp; allRows.append(rowlist)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
csvFile.writerow(fieldnames)
for row in allRows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; csvFile.writerow(row)&lt;/PRE&gt;&lt;BR /&gt;*mostly stolen from &lt;A href="http://forums.esri.com/Thread.asp?c=93&amp;amp;f=1729&amp;amp;t=210918" rel="nofollow noopener noreferrer" target="_blank"&gt;here&lt;/A&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This works for the most part.&amp;nbsp; Someone used degrees symbols and other odd characters and i'm having encoding/decoding issues.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:40:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/quick-export-csv-w-headers-via-python/m-p/306540#M23822</guid>
      <dc:creator>gregmohler</dc:creator>
      <dc:date>2021-12-11T14:40:31Z</dc:date>
    </item>
  </channel>
</rss>

