Cmdlet
ConvertTo-OfficeExcelWorkbook
Converts Excel workbooks between supported .xls and .xlsx formats.
Syntax
ConvertTo-OfficeExcelWorkbook [-AllowLossyLegacyConversion] [-Force] [-Open] [-OutputPath] <String> [-PassThru] [-Path] <String> [<CommonParameters>]#Parameter set:
All Parameter SetsDescription
Uses the OfficeIMO Excel normal load/save conversion path, including legacy XLS diagnostics and save preflight.
Examples
Convert a legacy XLS file to XLSX.
ConvertTo-OfficeExcelWorkbook -Path .\legacy.xls -OutputPath .\converted.xlsx -PassThruReads the .xls file and writes a .xlsx workbook.
Convert an XLSX workbook to native XLS.
ConvertTo-OfficeExcelWorkbook -Path .\report.xlsx -OutputPath .\report.xls -ForceWrites a supported native BIFF8 .xls workbook.
Parameters
- -AllowLossyLegacyConversion SwitchParameter
- Allow conversion when a legacy XLS source contains unsupported or preserve-only content.
- -Force SwitchParameter
- Overwrite an existing destination file.
- -Open SwitchParameter
- Open the converted workbook after saving.
- -OutputPath String
- Destination .xls or .xlsx file path.
- -PassThru SwitchParameter
- Emit the saved file information.
- -Path String
- Source .xls or .xlsx file path.
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.