Powershell Excel Automation


hi all,

hope can help, have excel document need create new sheet there doesn't seem simple way of creating new sheet in populated excel document. there easy way of creating new sheet in document without overwriting current excel spreadsheet?

the code people use following:

$xl = new-object -comobject excel.application

$workbook = $xl.workbooks.add()
$sheet1 = $workbook.worksheets.item(1)

the code overwrites current content , replaces new workbook, how can add sheet?

if i'm not clear on i'm asking please ask.

thanks

dave

this works:

$workbook = $xl.workbooks.open("c:\temp\test.xls")

$workbook.worksheets.add([system.reflection.missing]::value) | out-null



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Indexing Server

Schannel Issue

oclist /xml or /?