Cmdlet
Clear-OfficeExcelRange
Clears values, formulas, styles, and range metadata from an Excel worksheet range.
Syntax
Clear-OfficeExcelRange
[-All]
[-Comments]
[-ConditionalFormatting]
[-Contents]
[-DataValidations]
[-Formulas]
[-Hyperlinks]
[-Merges]
[-PassThru]
-Range <String>
[-Sheet <String>]
[-SheetIndex <Int32>]
[-Sparklines]
[-Styles]
[-Values]
[<CommonParameters>]#Parameter set:
ContextClear-OfficeExcelRange
[-All]
[-Comments]
[-ConditionalFormatting]
[-Contents]
[-DataValidations]
[-Formulas]
[-Hyperlinks]
[-Merges]
[-PassThru]
[-Path] <String>
-Range <String>
[-Sheet <String>]
[-SheetIndex <Int32>]
[-Sparklines]
[-Styles]
[-Values]
[<CommonParameters>]#Parameter set:
PathClear-OfficeExcelRange
[-All]
[-Comments]
[-ConditionalFormatting]
[-Contents]
[-DataValidations]
-Document <ExcelDocument>
[-Formulas]
[-Hyperlinks]
[-Merges]
[-PassThru]
-Range <String>
[-Sheet <String>]
[-SheetIndex <Int32>]
[-Sparklines]
[-Styles]
[-Values]
[<CommonParameters>]#Parameter set:
DocumentExamples
Clear cell contents without removing formatting.
Clear-OfficeExcelRange -Path .\Report.xlsx -Sheet Staging -Range B2:D20 -Contents -Hyperlinks -Confirm:$false
Get-OfficeExcelRange -Path .\Report.xlsx -Sheet Staging -Range B2:D20 |
Select-Object Address, Value, FormulaRemoves values and formulas from the selected range and saves the workbook.
Parameters
- -All SwitchParameter
- Clear all supported cell data and range metadata.
- -Comments SwitchParameter
- Clear comments in the selected range.
- -ConditionalFormatting SwitchParameter
- Clear conditional formatting rules that overlap the selected range.
- -Contents SwitchParameter
- Clear values and formulas.
- -DataValidations SwitchParameter
- Clear data validation rules that overlap the selected range.
- -Formulas SwitchParameter
- Clear formulas.
- -Hyperlinks SwitchParameter
- Clear hyperlinks that overlap the selected range.
- -Merges SwitchParameter
- Clear merged-cell definitions that overlap the selected range.
- -PassThru SwitchParameter
- Emit the object created or changed by the command.
- -Range String
- A1 range to clear.
- -Sheet String
- Worksheet name to update. Defaults to the current DSL sheet or the first workbook sheet.
- -SheetIndex Int32
- Worksheet index (0-based) to update. Defaults to the current DSL sheet or the first workbook sheet.
- -Sparklines SwitchParameter
- Clear sparklines whose target cells overlap the selected range.
- -Styles SwitchParameter
- Clear cell style indexes.
- -Values SwitchParameter
- Clear literal cell values.
- -Path String
- Workbook path to update.
- -Document ExcelDocument
- Workbook to update outside the DSL context.
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.