API Reference

Cmdlet

Rename-OfficeExcelNamedRange

Aliases: ExcelNamedRangeRename
Namespace PSWriteOffice
Aliases
ExcelNamedRangeRename
Inputs
OfficeIMO.Excel.ExcelDocument
Outputs
System.Boolean

Renames a workbook or sheet-scoped Excel named range.

Remarks

Renames a workbook or sheet-scoped Excel named range.

Examples

Authored help example

Rename a named range and keep the workbook reusable.

PS>


$workbook = Get-OfficeExcel -Path .\Report.xlsx
            $renamed = $workbook | Rename-OfficeExcelNamedRange -Name RevenueRange -NewName Revenue_Current -PassThru
            Save-OfficeExcel -Document $workbook
        

Renames the defined name through OfficeIMO validation before saving the workbook.

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.

Syntax

Rename-OfficeExcelNamedRange [-Global] -Name <String> -NewName <String> [-PassThru] [-Save] [-ValidationMode <Sanitize|Strict>] [<CommonParameters>]
#
Parameter set: Context

Parameters

Global SwitchParameter optionalposition: namedpipeline: False
Use workbook-global scope from inside the DSL.
Name String requiredposition: 0pipeline: False
Named range name.
NewName String requiredposition: 1pipeline: False
New named range name.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit a result object.
Save SwitchParameter optionalposition: namedpipeline: False
Save the workbook immediately after renaming the name.
ValidationMode NameValidationMode optionalposition: namedpipeline: Falsevalues: 2
Defined-name validation mode.
Possible values: Sanitize, Strict

Outputs

System.Boolean

Rename-OfficeExcelNamedRange -Document <ExcelDocument> -Name <String> -NewName <String> [-PassThru] [-Save] [-Sheet <String>] [-SheetIndex <Nullable`1>] [-ValidationMode <Sanitize|Strict>] [<CommonParameters>]
#
Parameter set: Document

Parameters

Document ExcelDocument requiredposition: namedpipeline: True (ByValue)
Workbook document.
Name String requiredposition: 0pipeline: False
Named range name.
NewName String requiredposition: 1pipeline: False
New named range name.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit a result object.
Save SwitchParameter optionalposition: namedpipeline: False
Save the workbook immediately after renaming the name.
Sheet String optionalposition: namedpipeline: False
Worksheet name for a sheet-scoped operation.
SheetIndex Nullable`1 optionalposition: namedpipeline: False
Zero-based worksheet index for a sheet-scoped operation.
ValidationMode NameValidationMode optionalposition: namedpipeline: Falsevalues: 2
Defined-name validation mode.
Possible values: Sanitize, Strict

Outputs

System.Boolean