Submitted By: Kent Finkle

Copies a worksheet from an existing spreadsheet to a new spreadsheet.

PowerShell
Edit|Remove
# Script name: CopyWorksheet.ps1
# Created on: 2007-01-11
# Author: Kent Finkle
# Purpose: How Can I Use Windows PowerShell to Copy a Worksheet to a New Spreadsheet?

$xl = new-object -comobject excel.application
$xl.Visible = $true
$wb = $xl.Workbooks.Open("C:\Scripts\Test.xls")
$ws = $wb.Worksheets.Item("Sheet1")
$ws.Activate

$ws.Copy()