Select to view content in your preferred language

How to delete spaces in Header of .csv?

3940
4
05-30-2011 11:37 PM
CelinaThom
Emerging Contributor
I am using model builder and want to import and join two comma deliniated tables.  The tables have spaces in the header (i.e. " Drawing Name") that muck up arcmap.  Is there any way in modelbuilder to correct the header before I attempt to import the table?  I'm a very basic user of python and I'm sure there is a scripting way to do it, but would prefer if at all possible to stick with modelbuilder.  Thanks!

**accidentally cross-posted in Data Models forum**
0 Kudos
4 Replies
KimOllivier
Honored Contributor
The "Text loader", part of Microsoft libraries needs a Schema.ini to properly define the field names and types. ArcGIS uses it. If schema.ini does not exist it defaults to using the header fields which will then fail if they are not valid field names.

With a schema.ini you can rename the fields on import and also define the field type.

The schema.ini is a recent discovery for me, and has saved me hours of work creating custom scripts.
It is mentioned in the ArcGIS help, but do a Google search for more details from Microsoft.
http://msdn.microsoft.com/en-us/library/ms709353%28v=vs.85%29.aspx
CelinaThom
Emerging Contributor
Kimo:  AWESOME AWESOME AWESOME!  What a great tip that solves so many more problems than just the one I mentioned...!!!!!!!!  Thanks so much for your answer!
0 Kudos
BruceHarold
Esri Regular Contributor

Hi

There are a few incarnations of tools that handle a schema.ini file, here is one for Pro:

http://www.arcgis.com/home/item.html?id=d887241f6908466a984c94631fd1974f

Regards

0 Kudos
KimOllivier
Honored Contributor
0 Kudos