API Reference

Cmdlet

ConvertTo-OfficeExcelWorkbook

Namespace PSWriteOffice
Inputs
None
Outputs
System.IO.FileInfo

Converts Excel workbooks between supported .xls and .xlsx formats.

Remarks

Uses the OfficeIMO Excel normal load/save conversion path, including legacy XLS diagnostics and save preflight.

Examples

Authored help example

Convert a legacy XLS file to XLSX.

PS>


ConvertTo-OfficeExcelWorkbook -Path .\legacy.xls -OutputPath .\converted.xlsx -PassThru
        

Reads the .xls file and writes a .xlsx workbook.

Convert an XLSX workbook to native XLS.

PS>


ConvertTo-OfficeExcelWorkbook -Path .\report.xlsx -OutputPath .\report.xls -Force
        

Writes a supported native BIFF8 .xls workbook.

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

ConvertTo-OfficeExcelWorkbook [-AllowLossyLegacyConversion] [-Force] [-Open] -OutputPath <String> [-PassThru] -Path <String> [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

AllowLossyLegacyConversion SwitchParameter optionalposition: namedpipeline: False
Allow conversion when a legacy XLS source contains unsupported or preserve-only content.
Force SwitchParameter optionalposition: namedpipeline: False
Overwrite an existing destination file.
Open SwitchParameter optionalposition: namedpipeline: False
Open the converted workbook after saving.
OutputPath String requiredposition: 1pipeline: Falsealiases: OutPath
Destination .xls or .xlsx file path.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the saved file information.
Path String requiredposition: 0pipeline: Falsealiases: FilePath
Source .xls or .xlsx file path.

Outputs

System.IO.FileInfo