PowerShell Excel 2016 insert

669 views Asked by At

Could someone tell me how to perform an insert using PowerShell for Excel 2016?

I've tried this:

$erow = $ws.(1,1).entirerow
$active = $eRow.activate()
$active = $eRow.insert([microsoft.office.interop.excel.xlDirection]::xlDown)
1

There are 1 answers

0
Alexis-Emmanuel Haeringer On

Yes, what exactly do you mean by "insert"? :)

If you would like to insert row, create an excel sheet with an "Excel table" (it's more easy to handle) & follow the recipe: https://stackoverflow.com/a/29892939/2672544

And in order to add only row in your table:

[..]
$ws.Cells.ListObject.ListRows.Add(1)

And try & play with "tab tab" or better Get-Member !