# Powershell script to insert new columns in excel

**URL:** <https://forums.powershell.org/t/powershell-script-to-insert-new-columns-in-excel/11861>\
**Category:** PowerShell Help\
**Created:** [January 6, 2019, 1:40am UTC](https://forums.powershell.org/t/powershell-script-to-insert-new-columns-in-excel/11861 "2019-01-06T01:40:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![powershell-admin](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@powershell-admin](https://forums.powershell.org/u/powershell-admin)\
**Post date:** [January 6, 2019, 1:40am UTC](https://forums.powershell.org/t/powershell-script-to-insert-new-columns-in-excel/11861/1 "2019-01-06T01:40:40Z")

</div>

Hello,

I have an excel sheet which has 10 rows and 200 columns, i want to add columns in between those 200 columns, below every column i want to add 5 new columns, its similar to insert new column if we choose a column a right click and click insert, how can i achieve this in powershell

---

<div class="post-metadata">

**Author:** ![fullenw1](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/fullenw1/32/171_2.png) [@fullenw1](https://forums.powershell.org/u/fullenw1)\
**Post date:** [January 6, 2019, 2:37am UTC](https://forums.powershell.org/t/powershell-script-to-insert-new-columns-in-excel/11861/2 "2019-01-06T02:37:41Z")

</div>

There are some Excel modules on PowerShell gallery.

```
Find-Module -Name *excel*
```

I have already used some of them but I don’t remember which one is doing what.

You must try them out…

---

<div class="post-metadata">

**Author:** ![kvprasoon](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/kvprasoon/32/4449_2.png) [@kvprasoon](https://forums.powershell.org/u/kvprasoon)\
**Post date:** [January 6, 2019, 12:10pm UTC](https://forums.powershell.org/t/powershell-script-to-insert-new-columns-in-excel/11861/3 "2019-01-06T12:10:48Z")

</div>

You can use the famous [ImportExcel](https://www.powershellgallery.com/packages/ImportExcel/5.3.4) module to manage excel files in PowerShell. To add columns, Iterate through the object and add more entries then export it using Export-Excel cmdlet.

---

<div class="post-metadata">

**Author:** ![rob-simmers](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/rob-simmers/32/1010_2.png) [@rob-simmers](https://forums.powershell.org/u/rob-simmers)\
**Post date:** [January 7, 2019, 5:03pm UTC](https://forums.powershell.org/t/powershell-script-to-insert-new-columns-in-excel/11861/4 "2019-01-07T17:03:58Z")

</div>

You could also export it as a CSV and do the manipulation as a PSObject and export as CSV to avoid messing directly with Excel.

---

<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:33pm UTC](https://forums.powershell.org/t/powershell-script-to-insert-new-columns-in-excel/11861/5 "2024-05-16T20:33:27Z")

</div>


