Cmdlet
Rename-OfficeExcelNamedRange
Renames a workbook or sheet-scoped Excel named range.
Syntax
Rename-OfficeExcelNamedRange [-Global] [-Name] <String> [-NewName] <String> [-PassThru] [-Save] [-ValidationMode <Sanitize|Strict>] [<CommonParameters>]#Parameter set:
ContextRename-OfficeExcelNamedRange -Document <ExcelDocument> [-Name] <String> [-NewName] <String> [-PassThru] [-Save] [-Sheet <String>] [-SheetIndex <Int32>] [-ValidationMode <Sanitize|Strict>] [<CommonParameters>]#Parameter set:
DocumentExamples
Rename a named range and keep the workbook reusable.
$workbook = Get-OfficeExcel -Path .\Report.xlsx
$renamed = $workbook | Rename-OfficeExcelNamedRange -Name RevenueRange -NewName Revenue_Current -PassThru
Save-OfficeExcel -Document $workbookRenames the defined name through OfficeIMO validation before saving the workbook.
Parameters
- -Global SwitchParameter
- Use workbook-global scope from inside the DSL.
- -Name String
- Named range name.
- -NewName String
- New named range name.
- -PassThru SwitchParameter
- Emit a result object.
- -Save SwitchParameter
- Save the workbook immediately after renaming the name.
- -ValidationMode ExcelDefinedNameValidationMode
- Defined-name validation mode.
- Possible values:
Sanitize,Strict - -Document ExcelDocument
- Workbook document.
- -Sheet String
- Worksheet name for a sheet-scoped operation.
- -SheetIndex Int32
- Zero-based worksheet index for a sheet-scoped operation.
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.