Get-SLDocument


Synopsis

Gets an excel Document from the specified path and creates an instance of it for editing.

Syntax

Description

Gets an excel Document from the specified path and creates an instance of it for editing.

Parameters

-Path

Path where the document is located. Specify the complete path along with the file extension.

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

-WorkSheetName

If specified the worksheet will be selected for editing.

Required? False
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

Outputs

SpreadsheetLight.SLDocument

Notes

Examples

Example 1

Gets an instance of the document named &;39;MyFirstDoc&;39; and stores it in a variable named Doc.The last worksheet is made active and selected for editing.
Note: When a workbook contains multiple worksheets and you dont specify a worksheetname
by default the last worksheet will be selected as the active or current worksheet.

Example 2

Gets an instance of the document named &;39;MyFirstDoc&;39; and stores it in a variable named Doc.
since test1 is passed as a value to the worksheetname parameter, it is selected as the active worksheet.

Example 3

Positional parameters.

Example 4

Use dir to get the required excel document and then pipe it to Get-SLDcoument and work with it.
Note: you can pass in more than one document using dir. The result will be an array which be enumerated easily using foreach or foreach-object.

Related links