Select to view content in your preferred language

Table to csv..

3986
7
Jump to solution
05-28-2015 01:39 PM
surens
by
Deactivated User


Is there any tool in Arcmap that is helpful to convert table -> csv or text file..??

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
DarrenWiens2
MVP Honored Contributor

The following Python script will dump the table in the feature layer 'fc' to the csv file 'outCSV':

>>> import csv
... fc = "points"
... outCSV = r'C:/junk/myNewCSV.csv'
... with open(outCSV, 'w') as csvfile:
...     csvwriter = csv.writer(csvfile, delimiter=',')
...     with arcpy.da.SearchCursor(fc,"*") as cursor:
...         for row in cursor:
...             csvwriter.writerow(row)

View solution in original post

7 Replies
TimMarquardt1
Occasional Contributor

Yes...just open the attribute table and click on the Table Options menu.....Export... then chose Text File as the file type when you click the folder icon (2nd screen shot)

surens
by
Deactivated User


Thanks for help TIM.. but i would like to know if there is any tool for this in arcmap..??

0 Kudos
DarrenWiens2
MVP Honored Contributor

Here is the help for exporting tables. Hint: change the "Save as type" to 'Text File'.

surens
by
Deactivated User

Thanks for the help Darren but would like to know if there is any tool in arcmap which will help in this issue..??

0 Kudos
DarrenWiens2
MVP Honored Contributor

You could try this tool set, or write your own in Python using the csv library.

0 Kudos
surens
by
Deactivated User

Hey Darren, I'm really thankful for the support you have given me but Im currently using 10.3 and when i use Conversion tool -> to excel i get option of .xls file.. can i either get the tool or scrpit for csv..??

0 Kudos
DarrenWiens2
MVP Honored Contributor

The following Python script will dump the table in the feature layer 'fc' to the csv file 'outCSV':

>>> import csv
... fc = "points"
... outCSV = r'C:/junk/myNewCSV.csv'
... with open(outCSV, 'w') as csvfile:
...     csvwriter = csv.writer(csvfile, delimiter=',')
...     with arcpy.da.SearchCursor(fc,"*") as cursor:
...         for row in cursor:
...             csvwriter.writerow(row)