Cmdlet
Repair-OfficeExcelWorkbook
Runs OfficeIMO safe workbook repairs for common package, table, view, print, drawing, and calculation artifacts.
Syntax
Repair-OfficeExcelWorkbook [-NoSave] [-PassThru] [-Path] <String> [-SkipCalculation] [-SkipDefinedNames] [-SkipDrawings] [-SkipPrintSettings] [-SkipSheetViews] [-SkipTables] [<CommonParameters>]#Parameter set:
PathRepair-OfficeExcelWorkbook -Document <ExcelDocument> [-NoSave] [-PassThru] [-SkipCalculation] [-SkipDefinedNames] [-SkipDrawings] [-SkipPrintSettings] [-SkipSheetViews] [-SkipTables] [<CommonParameters>]#Parameter set:
DocumentExamples
Repair workbook package artifacts before handing the file to users.
$repair = Repair-OfficeExcelWorkbook -Path .\QuarterlyReport.xlsx -PassThru
$repair.Actions | Format-Table Category,SheetName,Message
if ($repair.After.HasErrors) {
$repair.After.Issues | Format-Table Severity,Category,SheetName,Address,Message
}Uses the reusable OfficeIMO repair pipeline. The command normalizes safe workbook artifacts and returns before/after diagnostics when -PassThru is used.
Parameters
- -NoSave SwitchParameter
- Do not save after applying repairs to an open document.
- -PassThru SwitchParameter
- Emit a repair report object.
- -Path String
- Workbook path to repair.
- -SkipCalculation SwitchParameter
- Skip calculation-chain cleanup and recalc-on-open metadata.
- -SkipDefinedNames SwitchParameter
- Skip defined-name repairs.
- -SkipDrawings SwitchParameter
- Skip drawing, image, and header/footer picture repairs.
- -SkipPrintSettings SwitchParameter
- Skip print, page-break, and page-scale repairs.
- -SkipSheetViews SwitchParameter
- Skip worksheet view and freeze-pane repairs.
- -SkipTables SwitchParameter
- Skip worksheet table repairs.
- -Document ExcelDocument
- Open workbook document to repair.
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.