Remove-Worksheet¶
SYNOPSIS¶
Removes one or more worksheets from one or more workbooks
SYNTAX¶
Remove-Worksheet [[-FullName] <Object>] [[-WorksheetName] <String[]>] [-Show] [-WhatIf] [-Confirm]
[<CommonParameters>]
DESCRIPTION¶
EXAMPLES¶
EXAMPLE 1¶
Removes the worksheet named 'Sheet1' from 'Test1.xlsx'
EXAMPLE 2¶
Removes the worksheet named 'Sheet1' and 'Target1' from 'Test1.xlsx'
EXAMPLE 3¶
Removes the worksheets and then launches the xlsx in Excel
EXAMPLE 1¶
Removes 'Sheet1' from all the xlsx files in the c:\reports directory
PARAMETERS¶
-FullName¶
The fully qualified path to the XLSX file(s)
Type: Object
Parameter Sets: (All)
Aliases: Path
Required: False
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-Show¶
If specified the file will be opened in excel after the sheet is removed.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-WorksheetName¶
The worksheet to be removed (sheet1 by default)
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: Sheet1
Accept pipeline input: False
Accept wildcard characters: False
-Confirm¶
Prompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf¶
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters¶
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.