Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Repair-OfficeExcelWorkbook

Aliases: ExcelRepair, ExcelWorkbookRepair
Module PSWriteOffice
Aliases
ExcelRepair ExcelWorkbookRepair
Inputs
OfficeIMO.Excel.ExcelDocument
Outputs
System.Management.Automation.PSObject

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: Path
Repair-OfficeExcelWorkbook -Document <ExcelDocument> [-NoSave] [-PassThru] [-SkipCalculation] [-SkipDefinedNames] [-SkipDrawings] [-SkipPrintSettings] [-SkipSheetViews] [-SkipTables] [<CommonParameters>]
#
Parameter set: Document

Examples

Authored help example

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 optional
Do not save after applying repairs to an open document.
-PassThru SwitchParameter optional
Emit a repair report object.
-Path String requiredposition: 0aliases: FilePath, InputPathsets: Path
Workbook path to repair.
-SkipCalculation SwitchParameter optional
Skip calculation-chain cleanup and recalc-on-open metadata.
-SkipDefinedNames SwitchParameter optional
Skip defined-name repairs.
-SkipDrawings SwitchParameter optional
Skip drawing, image, and header/footer picture repairs.
-SkipPrintSettings SwitchParameter optional
Skip print, page-break, and page-scale repairs.
-SkipSheetViews SwitchParameter optional
Skip worksheet view and freeze-pane repairs.
-SkipTables SwitchParameter optional
Skip worksheet table repairs.
-Document ExcelDocument requiredpipeline: True (ByValue)sets: Document
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.