This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
on 11-14-201611:38 AM- edited
2 weeks ago
Here is the original question posted in the Forum:
I am working on a project where basically I need to use the input data tool to import a csv file for every day of the month. Is there any easier way to do this than to open 30 input data icons then doing a join on all 20 of them? It seems like maybe I could actually just chose input data one time and highlight all the files I need but that didn't work. its just that it takes a long time to drag 30 data inputs in then join them all. They are just CSV files.
There are several ways to do this - the easiest is to use the wildcard character in an Input Tool (master it here) as suggested one of the responders:
Depending on the file name and location you can even use a standard input tool for this. For example if you have a number of csv's on the the C drive named Sales_20160101.csv, Sales_20160102.csv, ..., Sales_20160309.csv you could enter C:\Sales_*.csv in a standard input tool and all files would be picked up and merged.
In the event the files are named differently, are not all in the same directory, and/or you need to further limit which files are read in, you'll want to use the other method suggested with the Dynamic Input Tool (learn about the tool in detail here):
You can use a dynamic input tool to load a set of files.
It takes a list and load them all. It can be configured to include the filename as an entry one very row as well.
There is also a Directory Tool which will search a folder for a list of files.
The combination of the two should allow you to do what you need.
These methods apply to most file types, not just CSV files. The main point in both methods is that in order for either method to work is that each of the files must have the same schema, otherwise you will get read errors.
If your files have different schemas, all is not lost. Take a look at this article for a way to make it work!