Hi,
I have a Feature Class which shows the extent of a number of associated CSV files containing DTM points. Using a select by location query, I have created a second feature class which contains a subset of those CSV files I want to import to a GDB.
My question is, is there a way to import CSV files based on the field name in the feature class so I only import those CSV files?
Thanks,
Paul
Solved! Go to Solution.
I ended up doing this in a roundabout fashion as I hadn't received the above suggestions in time.
I used the selection from the Feature Class to create a text file containing a list of the files I wanted called "PullFiles.txt"
I created a new folder called "HSO_WB_Files" and used PowerShell to copy the relevant files to that folder using the below script found online:
I batch imported all the CSV files into a GDB.
I then used a Model to Iterate through all the files and create XY point files from each
The suggestions by Bob and Dale are more elegant, but this worked anyway.
You could make a list of the table names and use Python to iterate over the list and add the tables to the map.
Thanks Bob, thats' a good solution
Another way to do this is within ModelBuilder. ModelBuilder has the Iterate Row Selection and Iterate Field Value iterator which you could use to grab the value of the CSV REF field into a model variable. You could then use inline substitution with this model variable to construct the pathname to the CSV file, then feed that pathname into the Table To Table tool to create a .gdb table.
This topic explains all the iterators available to you.
Thanks Dale, that would work alright!
I ended up doing this in a roundabout fashion as I hadn't received the above suggestions in time.
I used the selection from the Feature Class to create a text file containing a list of the files I wanted called "PullFiles.txt"
I created a new folder called "HSO_WB_Files" and used PowerShell to copy the relevant files to that folder using the below script found online:
I batch imported all the CSV files into a GDB.
I then used a Model to Iterate through all the files and create XY point files from each
The suggestions by Bob and Dale are more elegant, but this worked anyway.