Solved! Go to Solution.
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: rowlist = [] for field in fieldnames: rowlist.append(row.getValue(field)) allRows.append(rowlist) csvFile.writerow(fieldnames) for row in allRows: csvFile.writerow(row)
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")
TypeError: QuickExport() takes at most 2 arguments (3 given)
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: rowlist = [] for field in fieldnames: rowlist.append(row.getValue(field)) allRows.append(rowlist) csvFile.writerow(fieldnames) for row in allRows: csvFile.writerow(row)
I don't know about Quick Export, but this exports a feature class to csv, with headers.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: rowlist = [] for field in fieldnames: rowlist.append(row.getValue(field)) allRows.append(rowlist) csvFile.writerow(fieldnames) for row in allRows: csvFile.writerow(row)
*mostly stolen from here