API Reference
Command
Set-OfficeExcelNamedRange
Creates or updates a named range.
Remarks
Creates or updates a named range.
Examples
Define a named range inside a sheet.
PS>ExcelSheet 'Data' { Set-OfficeExcelNamedRange -Name 'Totals' -Range 'B2:B50' }
Creates a sheet-scoped name for the range.
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
Set-OfficeExcelNamedRange [-Global] [-Hidden] -Name <String> [-PassThru] -Range <String> [-Save] [-ValidationMode <Sanitize|Strict>] [<CommonParameters>]#Parameter set:
ContextParameters
- Global SwitchParameter
- Force a workbook-global name even inside a sheet block.
- Hidden SwitchParameter
- Mark the defined name as hidden.
- Name String
- Name of the defined range.
- PassThru SwitchParameter
- Emit the name after creation.
- Range String
- Range in A1 notation.
- Save SwitchParameter
- Save the workbook immediately after setting the name.
- ValidationMode NameValidationMode
- Validate or sanitize the defined name.
- Possible values:
Sanitize,Strict
Outputs
System.Object
Set-OfficeExcelNamedRange -Document <ExcelDocument> [-Hidden] -Name <String> [-PassThru] -Range <String> [-Save] [-Sheet <String>] [-SheetIndex <Nullable`1>] [-ValidationMode <Sanitize|Strict>] [<CommonParameters>]#Parameter set:
DocumentParameters
- Document ExcelDocument
- Workbook to operate on outside the DSL context.
- Hidden SwitchParameter
- Mark the defined name as hidden.
- Name String
- Name of the defined range.
- PassThru SwitchParameter
- Emit the name after creation.
- Range String
- Range in A1 notation.
- Save SwitchParameter
- Save the workbook immediately after setting the name.
- Sheet String
- Worksheet name when using Document.
- SheetIndex Nullable`1
- Worksheet index (0-based) when using Document.
- ValidationMode NameValidationMode
- Validate or sanitize the defined name.
- Possible values:
Sanitize,Strict
Outputs
System.Object