Import multiple (csv) files at once into a single table

User c65f7ade2a

15-11-2010 19:36:44

Hi,


I have a number of CSV files with identical column headers, which I would like to import into a single table. Is there an easy way to do this as a batch process rather than adding the files one by one.


 


thanks


Ralph

ChemAxon fa971619eb

16-11-2010 14:54:23

Hi Ralph,


There is no way in IJC other than to import each file at a time.


Your best bet would seem to be to merge the files together into one single file outside IJC and then import that one merged file. The only tricky bit would be to make sure you only get the header from the first file. One way to do this is like this:


cat *.csv | grep -v FIELD_NAME_1 > all.csv

This command (on Linux or Mac) joins together all files with csv extension but filters out lines containing 'FIELD_NAME_1' which I have assumed is one of the column headers that is present in every file, and not present in any of the data lines. Obviously you will need to cahnge that to some text from your header. The output is a file named all.csv that will be missing the header, but you can easily add that back e.g with a text editor


If you are on Windows then there is probably an equivalent command, though I'm no expert here. Any Windows gurus out there with any ideas?


Tim

User c65f7ade2a

16-11-2010 15:02:37

Thanks Tim


 


Ralph