4

In ArcMap 10.2 I'm following this workflow:

  1. Add .csv to map.
  2. Right click .csv, --> "Display XY Data"
  3. Right click XY Event Layer, --> "Data" --> "Export Data" --> save it as a shapefile.

There are 1232 rows in my .csv but the resulting shapefile has only the first 235 rows. The last row in my new shapefile (row 235) has one double quotation mark (") in the fifth (text) column.

This screen grab shows how the double quotation mark should appear in its cell.

enter image description here

This screen grab shows the result of bringing that row into a shapefile in ArcMap. Notice the quotation mark is absent but the lat, lon and subsequent field values appear in the same text cell, while the subsequent lat, lon, and so on fields are empty.

enter image description here

I found out that you can escape a double quotation mark by adding a second right after it, like this... (""), so I made this change manually in Excel. This was the solution. Next time I followed the above workflow I had all 1232 rows in my new shapefile.

How can I achieve this escaping of the double quotation mark in ArcMap rather than doing it manually in Excel?

A related side problem: Although setting the " manually to a "" in Excel allows all 1232 rows to be converted in ArcMap, the cell in question in the resulting shapefile has "" instead of where it should only have ". It look like this:

enter image description here

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Jul 17, 2018 at 0:42
6
  • 1
    Please edit your question and add some example data that demonstrates the issue (perhaps ~10 rows, i.e row 235 +- 5) formatted as code using the { } button so we can easily test. Commented Jul 17, 2018 at 1:08
  • 2
    If all you want is a shapefile from the CSV try Find & Replace in Notepad (or other text editor you prefer), exchange " for ~ (or # or |, just something that doesn't normally occur in a line) then display XY data, save as shape then open the shapefile in ArcMap, start editing, open the attribute table and find & replace your ~ character with " and it should be all good. It's a tedious workaround but should be fairly quick to do once.. are you likely to be needing to do this many times? Do you want a python solution? Commented Jul 17, 2018 at 1:11
  • @MichaelStimson - I will be doing this relatively infrequently. I don't think a python solution is necessary as the manual replace method is fairly straightforward. It's just disappointing to realize Arc has no way to cope with a double quotation mark. Commented Jul 18, 2018 at 23:05
  • What version of Excel? Commented Jul 19, 2018 at 7:27
  • @Luke - I'm using Excel 10 (Microsoft Professional Plus), version 14.0.7208.5000 (32-bit) Commented Jul 27, 2018 at 16:09

1 Answer 1

2

You need to double quote the double quote and enclose the entire value in double quotes.

Assuming your CSV looks something like the following when you open it directly in Notepad/text editor:

X,Y,ATTR
1,1,ABC DEF
1,2,BCD EFG
2,1,CDE" FGH
2,2,DEF GHI

If you open your CSV in Excel and save it again, Excel will automagically correct the quoting to:

X,Y,ATTR
1,1,ABC DEF
1,2,BCD EFG
2,1,"CDE"" FGH"
2,2,DEF GHI

And it will work in ArcMap:

enter image description here

Notes

  • I did nothing to manually escape the original double quote other than opening the CSV in Excel and clicking the save button.
  • Tested in ArcMap 10.3.1 and Microsoft Excel 2013.
answered Jul 17, 2018 at 3:04
5
  • 2
    "You need to double quote the double quote and enclose the entire value in double quotes" is my favourite instruction ever ;) Commented Jul 17, 2018 at 3:21
  • I'm opening the csv in Excel and saving it but Excel is not 'automagically' formatting the double quote. So instead I've done it manually (a la "CDE"" FGH"). Once again Arc successfully converts all 1232 lines but the resulting value in the new shapefile is "CDE"" FGH" rather than CDE" FGH. Commented Jul 18, 2018 at 23:01
  • @Luke - sorry, summer vacation got in the way. I'm using Excel via "Microsoft Office Professional Plus 2010". Commented Aug 21, 2018 at 20:06
  • @PolyGeo - I'm stuck on this question. No one appears to have the solution yet. Do you have any advice on how to solve the problem, or how to solicit further advice from the community? Commented Sep 21, 2018 at 1:33
  • @Waterman Your only option (to use the CSVs) as far as I can tell is to upgrade ArcGIS. Perhpas you could try saving as XLSX. You've already come across a different problem related to ArcGIS 10.2 that at least had a workaround, but I think you're going to keep coming across more ArcGIS 10.2 issues in future. Commented Sep 21, 2018 at 1:39

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.