mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
Add extension test back in
This commit is contained in:
@@ -348,13 +348,22 @@ function Import-Excel {
|
|||||||
process {
|
process {
|
||||||
if ($path) {
|
if ($path) {
|
||||||
|
|
||||||
# $Path = (Resolve-Path $Path).ProviderPath
|
if (!$firstTimeThru) {
|
||||||
$resolvedPath = (Resolve-Path $Path -ErrorAction SilentlyContinue)
|
# '.xls$|.xlsx$|.xlsm$'
|
||||||
if ($resolvedPath) {
|
$extension = [System.IO.Path]::GetExtension($Path)
|
||||||
$Path = $resolvedPath.ProviderPath
|
if ($extension -notmatch '.xlsx$|.xlsm$') {
|
||||||
}
|
throw "Import-Excel does not support reading this extension type $($extension)"
|
||||||
else {
|
}
|
||||||
throw "'$($Path)' file not found"
|
|
||||||
|
# $Path = (Resolve-Path $Path).ProviderPath
|
||||||
|
$resolvedPath = (Resolve-Path $Path -ErrorAction SilentlyContinue)
|
||||||
|
if ($resolvedPath) {
|
||||||
|
$Path = $resolvedPath.ProviderPath
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw "'$($Path)' file not found"
|
||||||
|
}
|
||||||
|
$firstTimeThru = $true
|
||||||
}
|
}
|
||||||
|
|
||||||
$stream = New-Object -TypeName System.IO.FileStream -ArgumentList $Path, 'Open', 'Read', 'ReadWrite'
|
$stream = New-Object -TypeName System.IO.FileStream -ArgumentList $Path, 'Open', 'Read', 'ReadWrite'
|
||||||
|
|||||||
Reference in New Issue
Block a user