Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

Stars 654
Forks 82
Open issues 1
Total downloads 4,320,051
Release OfficeIMO-v3.5.3
Language: C# Updated: 2026-11-03
Cmdlet

Rename-OfficeExcelNamedRange

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

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: Context
Rename-OfficeExcelNamedRange
-Document <ExcelDocument>
[-Name] <String>
[-NewName] <String>
[-PassThru]
[-Save]
[-Sheet <String>]
[-SheetIndex <Int32>]
[-ValidationMode <Sanitize|Strict>]
[<CommonParameters>]
#
Parameter set: Document

Examples

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 $workbook

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

Parameters

-Global SwitchParameter optionalsets: Context
Use workbook-global scope from inside the DSL.
-Name String requiredposition: 0
Named range name.
-NewName String requiredposition: 1
New named range name.
-PassThru SwitchParameter optional
Emit a result object.
-Save SwitchParameter optional
Save the workbook immediately after renaming the name.
-ValidationMode ExcelDefinedNameValidationMode optional
Defined-name validation mode.
Possible values: Sanitize, Strict
-Document ExcelDocument requiredpipeline: True (ByValue)sets: Document
Workbook document.
-Sheet String optionalsets: Document
Worksheet name for a sheet-scoped operation.
-SheetIndex Int32 optionalsets: Document
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.