Cant save excel file
$importcsv = join-path "$psscriptroot" "data.tsv"
$xl = new-object -com "excel.application"
$xl.visible = $true
$wb = $xl.workbooks.opentext($importcsv)
$wb.saveas("data.xlsx")
im getting error
you cannot call method on null-valued expression.
excel opened should, not save it.
$wbpath=join-path $pwd 'data.xlsx' $importcsv=join-path $pwd 'data.tsv' $xl = new-object -comobject excel.application $xl.visible = $true $xl.workbooks.opentext($importcsv) $xl.displayalerts = $false $xl.activeworkbook.saveas($wbpath,51) $xl.quit() while([system.runtime.interopservices.marshal]::releasecomobject($xl)){'released'}
you need this:
¯\_(ツ)_/¯
Windows Server > Windows PowerShell
Comments
Post a Comment