Moved back, CI has issues with $psscriptroot for xlsx

This commit is contained in:
dfinke
2019-07-04 12:03:05 -04:00
parent 25fb76d9b7
commit 914c61048b

View File

@@ -301,15 +301,6 @@ function Import-Excel {
begin {
$sw = [System.Diagnostics.Stopwatch]::StartNew()
# $Path = (Resolve-Path $Path).ProviderPath
$resolvedPath = (Resolve-Path $Path -ErrorAction SilentlyContinue)
if ($resolvedPath) {
$Path = $resolvedPath.ProviderPath
}
else {
throw "'$($Path)' file not found"
}
Function Get-PropertyNames {
<#
.SYNOPSIS
@@ -357,6 +348,15 @@ function Import-Excel {
process {
if ($path) {
# $Path = (Resolve-Path $Path).ProviderPath
$resolvedPath = (Resolve-Path $Path -ErrorAction SilentlyContinue)
if ($resolvedPath) {
$Path = $resolvedPath.ProviderPath
}
else {
throw "'$($Path)' file not found"
}
$stream = New-Object -TypeName System.IO.FileStream -ArgumentList $Path, 'Open', 'Read', 'ReadWrite'
if ($Password) { $ExcelPackage = New-Object -TypeName OfficeOpenXml.ExcelPackage -ArgumentList $stream , $Password }
else { $ExcelPackage = New-Object -TypeName OfficeOpenXml.ExcelPackage -ArgumentList $stream }