API Reference

Cmdlet

Repair-OfficeExcelWorkbook

Aliases: ExcelRepair, ExcelWorkbookRepair
Namespace 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.

Remarks

Runs OfficeIMO safe workbook repairs for common package, table, view, print, drawing, and calculation artifacts.

Examples

Authored help example

Repair workbook package artifacts before handing the file to users.

PS>


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

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

Repair-OfficeExcelWorkbook -InputPath <String> [-NoSave] [-PassThru] [-SkipCalculation] [-SkipDefinedNames] [-SkipDrawings] [-SkipPrintSettings] [-SkipSheetViews] [-SkipTables] [<CommonParameters>]
#
Parameter set: Path

Parameters

InputPath String requiredposition: 0pipeline: Falsealiases: FilePath, Path
Workbook path to repair.
NoSave SwitchParameter optionalposition: namedpipeline: False
Do not save after applying repairs to an open document.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit a repair report object.
SkipCalculation SwitchParameter optionalposition: namedpipeline: False
Skip calculation-chain cleanup and recalc-on-open metadata.
SkipDefinedNames SwitchParameter optionalposition: namedpipeline: False
Skip defined-name repairs.
SkipDrawings SwitchParameter optionalposition: namedpipeline: False
Skip drawing, image, and header/footer picture repairs.
SkipPrintSettings SwitchParameter optionalposition: namedpipeline: False
Skip print, page-break, and page-scale repairs.
SkipSheetViews SwitchParameter optionalposition: namedpipeline: False
Skip worksheet view and freeze-pane repairs.
SkipTables SwitchParameter optionalposition: namedpipeline: False
Skip worksheet table repairs.

Outputs

System.Management.Automation.PSObject

Repair-OfficeExcelWorkbook -Document <ExcelDocument> [-NoSave] [-PassThru] [-SkipCalculation] [-SkipDefinedNames] [-SkipDrawings] [-SkipPrintSettings] [-SkipSheetViews] [-SkipTables] [<CommonParameters>]
#
Parameter set: Document

Parameters

Document ExcelDocument requiredposition: namedpipeline: True (ByValue)
Open workbook document to repair.
NoSave SwitchParameter optionalposition: namedpipeline: False
Do not save after applying repairs to an open document.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit a repair report object.
SkipCalculation SwitchParameter optionalposition: namedpipeline: False
Skip calculation-chain cleanup and recalc-on-open metadata.
SkipDefinedNames SwitchParameter optionalposition: namedpipeline: False
Skip defined-name repairs.
SkipDrawings SwitchParameter optionalposition: namedpipeline: False
Skip drawing, image, and header/footer picture repairs.
SkipPrintSettings SwitchParameter optionalposition: namedpipeline: False
Skip print, page-break, and page-scale repairs.
SkipSheetViews SwitchParameter optionalposition: namedpipeline: False
Skip worksheet view and freeze-pane repairs.
SkipTables SwitchParameter optionalposition: namedpipeline: False
Skip worksheet table repairs.

Outputs

System.Management.Automation.PSObject