1

I'm an ArcGIS newbie and I'm struggling to keep the data type from changing from numeric to text for my fields in a CSV table.

I've found that copying the table, pasting it into a new Excel document and then changing the fields manually there works, but I have to do that every single time I open the Excel table/import it to ArcGIS Pro. Also, I can't edit the field type in Pro and it's not letting me create a new field and set it equal to the original field I'm trying to edit.

I've included an example of the problem. What's also weird is the fact that only half of them get switched to text when I import it.

enter image description here

1
  • 1
    CSV files don't record field data type, so ArcGIS looks at the first few rows (I think it's 8) to try to determine the type. What I do is add some dummy data into the first row under the headers - text into text fields, numbers into number fields, dates into date fields, and ArcGIS almost always gets it right after that.
    – Midavalo
    Jun 11, 2020 at 0:40

1 Answer 1

1

as stated by Midavalo since textfiles (csv, txt, asc,) don't explicitly store or state their field's type, ArcMap and ArcGIS Pro have to make an educated guess at the field type. The guess is based on the contents of the fields.

There are 2 approaches that come to mind to avoid manual work.

#1 create a schema.ini in the same folder as the text file. Within the schema.ini you can specify field names and types as described in ArcGIS Pro doc: add an ascii or text file table

#2 create a table up front, there define the fields as you want them, then use the Append gp tool with the text file as input, and your pre-created table as the target.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.