Iterate through csv files in model builder

6489
2
11-04-2011 08:04 AM
MichaelHendricks
New Contributor
I am trying to iterate through a folder of .csv files and do some geoprocesing on each file. The files are GPS data and I want to start by using the XY Event Layer Tool.  The Table Iterator tool only accepts .DBF or INFO tables as input, so that is no help. The Iterator Files Tool will accept the CSV file input, but its ouput does will no go go into the XY event layer tool.  Any thoughts?
0 Kudos
2 Replies
ShitijMehta
Esri Regular Contributor

  • Put all you csv files in a folder

  • Use Iterate Table iterator.

  • Set the folder with the csv files as input workspace

  • Don't select anything for table type optional parameter.


  • Connect the output of the iterator to either the Copy Rows tool or the Table to Table tool.

  • Use inline variable substitution for the name of the output table (%Name%/Out_%Name%/or something like this)

  • Run the model till this point once.

  • After running you can validate and connect the output of the Copy Rows/Table to Table tool to the XY Event Layer tool. Save the output of the XY Layer by Copy Rows again.

  • Use inline variable substitution %Name % again for the output name if you want.

SteveSawyer
New Contributor II
Please note that the Iterate needs to be in a sub-model due to the fact that it runs many times...then place the sub-model into the Main model.
I have attached 2 scripts for importing CSV files that are located in an FTPShare Dir..  I followed the Online Help for these scripts.

Maybe you all can help me as well.  Although, I have made these scripts from the Online Help they still do not seem to work.
It Iterates just fine.  It does not get to the Append function.  It will work when I break the connection (after initial run) and Append
into the LabDatEntry Table located in a file geodatabase.

Any thoughts why this does not go through the entire model?

SteveSawyer
steve.sawyer@health.ri.gov
0 Kudos