Help merging 4 .csv files into one

SERBEM

Member
I have a proces where I am getting a lot of data in .csv format - at the end of my proces I have 4 .csv files who I need to merge into one file and throw back in one .csv file. How do I actually merge those 4 files into one? Any suggestions? Thanks in advance
 

gil.silva

Active Member
Hello,

There are a couple of options to perform that:
IF the CSV are quite small (less than 10k rows):
  1. Use Excel VBO: get worksheet as collection
  2. Use Utility - Collection Manipulation: Append Rows to Collection
  3. Repeat for all the 4 CSV files
  4. Write Collection to file (Excel VBO)
IF the CSV are very big:
  1. Open 1st CSV
  2. Use Excel VBO: Get Number of Rows
  3. Open the other CSVs
  4. Excel VBO: Copy and Paste Worksheet range (starting in the row: nº of rows of 1st CSV + 1)
  5. Repeat for the other CSV files
Basically you can use the Excel VBO to perform any action in a CSV file, like in a XLS(X) file
 

SERBEM

Member
I ended ud with something else:
Import CSV fil with custom delimiters ( a code action I found somewhere on forum, because my files were using ; delimiters )
Imported the first file, than imported the second file to a temp collection and Append Rows to Collection, empty the temp collection than the third and forth same way.
After getting everything into a collection I found out that the data was in wrong encoding not UTF8 - so I made a loop to change some words if they appaired in the collection and at the end I coded a new action "Save as CSV delimiter in UTF8 format".
So now its working :) First time I tried to code a little in C# and it was so cool when I got it working.
 
Top