Acabei usando o Powershell para automatizar a conversão. Aqui está o meu script para qualquer pessoa interessada:
function ConvertTo-XLSX {
<#
.SYNOPSIS
XLS files within a provided path are recursively enumerated and convert to XLSX files.
.DESCRIPTION
XLS files within a provided path are recursively enumerated and convert to XLSX files.
The original XLS files remain intact, a new XLSX file will be created.
.PARAMETER Path
This parameter takes the input of the path where the XLS files are located.
.PARAMETER Visible
Using the parameter will show you how Excel does the work. Not using the parameter will enable Excel
to accomplish its tasks in the background.
Note: By not using this parameter you will be able to convert some XLS files which have corruptions
in them, when using the parameter and therefor the Excel GUI will give you an error.
.PARAMETER ToFolder
This parameter enables you to provide a location where the file is saved. When this parameter is
not used, the file will be saved as an XLS file in the same location as where the
original XLS file is located.
.PARAMETER Password
If specified, the password will be used to encrypt the converted Excel document. Passwords are case
sensitive and must be less than 15 characters long.
.PARAMETER Force
If specified, then files that have already been converted (there is already a file with the same name
but a .xlsx extension in the output directory) will be re-converted.
.EXAMPLE
ConvertTo-XLSX -Path 'D:\Data12'
.EXAMPLE
ConvertTo-XLSX -Path 'D:\Data12' -Visible
.EXAMPLE
ConvertTo-XLSX -Path 'D:\Data12' -ToFolder 'D:\Data12XLSX'
.EXAMPLE
ConvertTo-XLSX -Path 'D:\Data12' -Visible -ToFolder 'D:\Data12XLSX'
.EXAMPLE
ConvertTo-XLSX -Path 'D:\Data12' -Password 'SecureP@ssword'
.EXAMPLE
ConvertTo-XLSX -Path 'D:\Data12' -Force
#>
[cmdletbinding()]
param (
[parameter(mandatory=$true)][string]$Path,
[parameter(mandatory=$false)][switch]$Visible,
[parameter(mandatory=$false)][string]$ToFolder,
[parameter(mandatory=$false)][string]$Password,
[parameter(mandatory=$false)][switch]$Force
)
begin {
Add-Type -AssemblyName Microsoft.Office.Interop.Excel
$xlFixedFormat = [Microsoft.Office.Interop.Excel.XlFileFormat]::xlWorkbookDefault
Write-Verbose 'Opening Excel COM object.'
$Excel = New-Object -ComObject excel.application
if ($Visible -eq $true) {
$Excel.visible = $true
} else {
$Excel.visible = $false
$Excel.DisplayAlerts = $false
$Excel.ScreenUpdating = $false
$Excel.UserControl = $false
$Excel.Interactive = $false
}
$filetype = "*xls"
} process {
if (Test-Path -Path $Path) {
Get-ChildItem -Path $Path -Include '*.xls' -recurse | ForEach-Object {
Write-Verbose "Processing $($_.Basename)"
if ($ToFolder -ne '') {
$FilePath = Join-Path $ToFolder $_.BaseName
$FilePath += ".xlsx"
} else {
$FilePath = ($_.fullname).substring(0, ($_.FullName).lastindexOf("."))
$FilePath += ".xlsx"
}
if (!(Test-Path $FilePath) -Or $Force) {
Write-Verbose "Opening $($_.Basename)"
$WorkBook = $Excel.workbooks.open($_.fullname)
Write-Verbose "Saving $($_.Basename) to $FilePath with password $Password"
$WorkBook.saveas($FilePath, $xlFixedFormat, $Password)
Write-Verbose "Closing $($_.Basename)"
$WorkBook.close()
} else {
Write-Verbose "$($_.Basename) already converted."
}
}
} else {
return 'No path provided or access has been denied.'
}
} end {
Write-Verbose 'Closing Excel'
$Excel.Quit()
$Excel = $null
[gc]::collect()
[gc]::WaitForPendingFinalizers()
}
}
Isso foi baseado em um roteiro de Jeff Wouters encontrado aqui: