CSV Utility to split or combine CSV files - Perficient Blogs
Blog
  • Topics
  • Industries
  • Partners

Explore

Topics

Industries

Partners

CSV Utility to split or combine CSV files

I thought I’d share a little utility I wrote using PowerShell and PrimalForms a while back. Having done numerous migrations using CSV files I’m always looking for ways to speed things up, especially when dealing with the tedious tasks of working with CSV files. Frequently I would have to create or combine CSV files for various migration-related tasks. Using Excel was becoming cumbersome. Since I had been doing a lot of PowerShell scripting, I’d thought a script might make things easier. So, after some trial and error I ended up with this tool. I’ve used this utility for Quest Groupwise Migrator for Exchange and BPOS migrations but you may have other applications that might benefit from something like this.
There’s two ways to use this utility. One way is to break up a CSV file into smaller more equal parts and the other way is to combine several CSVs back into one file. When combining CSV files they all need to have the same field headers otherwise it won’t work properly. One of the migration tools I used leveraged CSV files to target specific objects so I used the Split CSV file option to create smaller files that I could easily distribute across multiple consoles. The migration tool also created its own CSV output files with statistics embedded so I wrote a quick batch file to collect them all in one place, then I used the Combine CSV Files option to reconstitute the data into one big file which could be used in Excel or another application for processing.
Hopefully someone reading this will find this utility useful. Use it in good health.
System requirements: PowerShell 2.0
And now for the disclaimer…
Note: This utility is provided as-is. Use at your own risk. No further support will be provided.
Download: CSV Utility

5 thoughts on “CSV Utility to split or combine CSV files

  1. Hi, Erik. I arrived here after scrolling google. I have a question. Does the program combine the files in memory or out of memory. I need to combine it out of memory from the hard disk as I have big cvs files for statistics.
    Kind regards
    Emilio

  2. thanks for the software ,in my softaware it includes headers of each csv, but it not……….! thanks once again

  3. Thanks for this application, i really liked it and the best thing i like it, it can search the files in the sub directories…the only problem i am facing right now…is I have huge chunk of files which I need to combine into one file…the one that I have right now is 31k to be precise..and when i try to do combine them into one..the application crashes and no longer becomes responsive..so do you mind if you can share the code, so that I can look in it and try to optimize it to make it work…your support is highly appreciated.
    @Andy

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to the Weekly Blog Digest:

Sign Up