Page 1 of 1
Merge CSV files in a folder
Posted: Fri Jul 13, 2018 11:46 am
by KaesDS
Hi guys,
is there a (powershell?) script to merge all CSV files in a folder that works for a job folder in Switch?
In my case the CSV files have no headers.
SwitchJobFolder "customername" containing
customername.csv, customername_1.csv, customername_2.csv etc. -> merge to
"customername.csv". (Like the "Merge PDF" Tool in Switch!)
I would be grateful for any suggestion.

Re: Merge CSV files in a folder
Posted: Fri Jul 13, 2018 12:02 pm
by sander
Laziest approach I can think of:
"copy *.csv combined.csv" via command prompt @ Windows.

Re: Merge CSV files in a folder
Posted: Mon Jul 16, 2018 11:20 pm
by dkelly
If you need a more advanced CSV merge solution contact
sales@apago.com for information about our collection of CSV utilities for Switch.
Re: Merge CSV files in a folder
Posted: Tue Jul 24, 2018 12:31 pm
by dk_jad
the command prompt approach is really simple and efficient, but only if you dont have headers in each csv file. AFAIK there is a command to strip the first line of a file, but i can't remember it. But if you have a file with only the headers, you could combine the csv's without header first, and then add the header in a second copy command. This way you can control that the header comes first(it copies alphabetically) because you define the output .csv filename in the first copy command.
Re: Merge CSV files in a folder
Posted: Tue Jul 24, 2018 2:01 pm
by KaesDS
sander wrote: ↑Fri Jul 13, 2018 12:02 pm
Laziest approach I can think of:
"copy *.csv combined.csv" via command prompt @ Windows.
Thanks sander!

This was my first attempt, but Switch would have to pass the path of the job folder to the .bat file. At the same time I should be able to pass the output path.
Maybe something like "copy %1/*.csv %2/merged.csv"?