# Merge two csvs

**URL:** <https://forums.powershell.org/t/merge-two-csvs/3750>\
**Category:** PowerShell Help\
**Created:** [February 12, 2015, 12:25pm UTC](https://forums.powershell.org/t/merge-two-csvs/3750 "2015-02-12T12:25:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![googleuser20](https://avatars.discourse-cdn.com/v4/letter/g/ac8455/32.png) [@googleuser20](https://forums.powershell.org/u/googleuser20)\
**Post date:** [February 12, 2015, 12:25pm UTC](https://forums.powershell.org/t/merge-two-csvs/3750/1 "2015-02-12T12:25:23Z")

</div>

I have two CSV files which share one column called database in common. I am looking to merge both CSVs into one. Here is a summary of what I am looking for.

file1.csv

Database Size freespace  
DB1 100 50  
DB2 80 55  
DB3 90 40

File2.csv

Database MBXCount WhiteSpace  
DB1 20 50  
DB2 100 2  
DB3 50 9

Desired file  
MergedFile.csv

Database Size freespace MBXCount WhiteSpace  
DB1 100 50 20 50  
DB2 80 55 100 2  
DB3 90 40 50 9

Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [February 12, 2015, 12:39pm UTC](https://forums.powershell.org/t/merge-two-csvs/3750/2 "2015-02-12T12:39:44Z")

</div>

The PowerShell team made a blog post on this a couple years ago: [Join-Object](http://blogs.msdn.com/b/powershell/archive/2012/07/13/join-object.aspx). As long as your set size is not too huge, it works great. (It doesn’t scale well; very slow when you’re trying to merge thousands of records.)

---

<div class="post-metadata">

**Author:** ![googleuser20](https://avatars.discourse-cdn.com/v4/letter/g/ac8455/32.png) [@googleuser20](https://forums.powershell.org/u/googleuser20)\
**Post date:** [February 13, 2015, 12:56pm UTC](https://forums.powershell.org/t/merge-two-csvs/3750/3 "2015-02-13T12:56:49Z")

</div>

Thanks for the feedback. I actually went with merge-csv function. It did what I was looking for.

[http://www.powershelladmin.com/wiki/An\_Advanced\_Cmdlet\_to\_Merge\_Csv\_Files\_in\_PowerShell](http://www.powershelladmin.com/wiki/An_Advanced_Cmdlet_to_Merge_Csv_Files_in_PowerShell)

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:46pm UTC](https://forums.powershell.org/t/merge-two-csvs/3750/4 "2024-05-16T20:46:23Z")

</div>


