Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Set-OfficeExcelSheet

Module
PSWriteOffice
Inputs
OfficeIMO.Excel.ExcelDocument
Outputs
OfficeIMO.Excel.ExcelSheet

Sets worksheet visibility, tab color and the active worksheet.

Syntax

Set-OfficeExcelSheet
[-Active]
[-Document <ExcelDocument>]
[-PassThru]
[-Sheet <OfficeSheetSelector>]
[-TabColor <OfficeColor>]
[-Visibility <Visible|Hidden|VeryHidden>]
[<CommonParameters>]
#
Parameter set: Default
Set-OfficeExcelSheet
[-Active]
[-Document <ExcelDocument>]
-NoTabColor
[-PassThru]
[-Sheet <OfficeSheetSelector>]
[-Visibility <Visible|Hidden|VeryHidden>]
[<CommonParameters>]
#
Parameter set: NoTabColor

Description

Omitted properties keep their values. Sheet accepts a name, one-based position or native worksheet. Inside an ExcelSheet block it defaults to the current worksheet; an explicit workbook defaults to its first sheet.

Examples

Hide lookup data and open on the summary.

Open-OfficeExcel -Path .\Pricing.xlsx {
    Set-OfficeExcelSheet -Sheet Lookups -Visibility VeryHidden -TabColor Accent2
    Set-OfficeExcelSheet -Sheet Summary -Active
}

Clear a live worksheet's tab color.

$book | Set-OfficeExcelSheet -Sheet 2 -NoTabColor -PassThru

Parameters

-Active SwitchParameter optional
Gets or sets whether this visible worksheet opens as the workbook's active worksheet.
-Document ExcelDocument optionalpipeline: True (ByValue)
Gets or sets an explicit live document; omission uses the enclosing content block.
-PassThru SwitchParameter optional
Gets or sets whether to emit the edited native worksheet.
-Sheet OfficeSheetSelector optional
Gets or sets a worksheet name, one-based position or native worksheet belonging to the workbook.
-TabColor OfficeColor optionalsets: Default
Gets or sets the literal or theme-based tab color.
-Visibility ExcelSheetVisibility optional
Gets or sets Visible, Hidden or VeryHidden; omission preserves visibility.
Possible values: Visible, Hidden, VeryHidden
-NoTabColor SwitchParameter requiredsets: NoTabColor
Gets or sets whether to remove the tab color; exclusive with TabColor.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.