Copy-SLWorkSheet


Synopsis

Copies or duplicates a worksheet.

Syntax

Description

Copies or duplicates a worksheet.Only one worksheet can be copied at a time. ,
If you want to copy multiple worksheets use a looping construct.

Parameters

-WorkBookInstance

Instance of an excel document that can be used for editing.

Required? True
Position? 0
Default value  
Accept pipeline input? true (ByValue)
Accept wildcard characters? False

-WorkSheetName

Name of the Worksheet to be copied.

Required? True
Position? 1
Default value  
Accept pipeline input? false
Accept wildcard characters? False

-NeWworkSheetName

Name of the target or duplicate worksheet.

Required? True
Position? 2
Default value  
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? False

-Force

Use force to overwrite an existing worksheet.

Required? False
Position? named
Default value  
Accept pipeline input? false
Accept wildcard characters? False

-WhatIf

Required? False
Position? named
Default value  
Accept pipeline input? false
Accept wildcard characters? False

-Confirm

Required? False
Position? named
Default value  
Accept pipeline input? false
Accept wildcard characters? False

This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

Inputs

String

SpreadsheetLight.SLDocument

Outputs

SpreadsheetLight.SLDocument

Notes

Examples

Example 1

An instance of MyfirstDoc is piped to Copy-SLWorkSheet with sheet2 being copied Sheet2_Copy.

Example 2

Demonstrates what happens when a user specifies a Newworksheetname that already exist&;39;s in the workbook.
The target worksheet is not overwritten and instead you get a warning asking you to specify the force parameter.

Example 3

Demonstrates the use of the force parameter to overwrite an existing worksheet.
The action is completed only if the user supplies either an &;39;y&;39; or &;39;A&;39; at the prompt.
Use with caution.

Related links