use ChangeExtension for robustness

This commit is contained in:
Edward Miller
2024-05-21 16:38:56 -05:00
parent 88a3aac640
commit b6034c37d8

View File

@@ -19,7 +19,7 @@ function ConvertTo-ExcelXlsx {
$xlFixedFormat = 51 #Constant for XLSX Workbook
$xlsFile = Get-Item -Path $singlePath
$xlsxPath = "{0}x" -f $xlsFile.FullName
$xlsxPath = [System.IO.Path]::ChangeExtension($xlsFile.FullName, ".xlsx")
if ($xlsFile.Extension -ne ".xls") {
throw "Expected .xls extension"