Add-SLWorkSheet


Synopsis

Adds one or more worksheets to an Excel Document.

Syntax

Description

Adds one or more worksheets to an Excel Document.If the specified worksheet to be added already exists in the workbook,
a random number is appended to the worksheetname to make it unique and then created as a worksheet.

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(s) to be created.
You can create more than one worksheet by specifying the names as a comma separated list.

Required? True
Position? 1
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

MyfirstDoc is piped to Add-SLWorksheet with 3 worksheets to be created – A,B,C

Example 2

An instance of MyFirstDoc is stored in a variable named doc which is then passed as a named parameter to Add-slworksheet.

Example 3

Demonstrates what happens when a user specifies a worksheetname that already exists in the workbook.

Example 4

New document named test is created and then Add-slworksheet is called to add additional worksheets A,B,C.
Note: &;39;Passthru&;39; parameter with New-SLDocument is required when you want to pass the document instance to the pipeline if not no object is passed.

Related links