This script will Convert Microsoft Works Spreadsheet file XLR to Microsoft Excel file XLS.
This script is to help users to convert .XLR file to .XLS file via PowerShell.
This script contains one advanced function Convert-OSCXLRtoXLS, you can use this script in the following ways:
Step1: Run the script in the Exchange Management Shell, type the one command: Import-Module <Script Path> at the prompt.
For example, type Import-Module C:\Script\ConvertXLRtoXLS.psm1
Here are some code snippets for your references.
#Connect Excel
$objExcel = New-Object -ComObject Excel.Application
#Create Save Path
$NewPath = $i -replace ".xlr",".xls"
#Check if the new path existed
If(Test-Path $NewPath){
#Remove the File
Remove-Item -Path $NewPath -Force | Out-Null
}
#Open XLR file in Excel
$objworkbook = $objExcel.Workbooks.Open($i)
#Save as XLS
$objworkbook.SaveAs($NewPath)
#Close Excel
$objworkbook.Close($false)
#Connect Excel $objExcel = New-Object -ComObject Excel.Application #Create Save Path $NewPath = $i -replace ".xlr",".xls" #Check if the new path existed If(Test-Path $NewPath){ #Remove the File Remove-Item -Path $NewPath -Force | Out-Null } #Open XLR file in Excel $objworkbook = $objExcel.Workbooks.Open($i) #Save as XLS $objworkbook.SaveAs($NewPath) #Close Excel $objworkbook.Close($false)
Example 1: Convert XLR file "Test1.xlr" to "Test1.xls".
Command: Convert-OSCXLRtoXLS -Path "C:\Test1.xlr"
Screenshot:
![]()
Example 2: Convert XLR files "Test1.xlr","Test2.xlr" to XLS format.
Command: C:\PS> Convert-OSCXLRtoXLS -Path "C:\Test1.xlr","C:\Test2.xlr"
Screenshot:

Microsoft Excel 2010
PowerShell 2.0