diff --git a/ImportExcel.psm1 b/ImportExcel.psm1 index 107b8ec..8b01941 100644 --- a/ImportExcel.psm1 +++ b/ImportExcel.psm1 @@ -327,11 +327,11 @@ function Import-Excel { $Path = (Resolve-Path $Path).ProviderPath Write-Verbose "Import Excel workbook '$Path' with worksheet '$Worksheetname'" $Stream = New-Object -TypeName System.IO.FileStream -ArgumentList $Path, 'Open', 'Read', 'ReadWrite' - } - Catch {throw "Could not open $Path ; $_ "} + } + Catch {throw "Could not open $Path ; $_ "} if ($Password) { - Try {$Excel = New-Object -TypeName OfficeOpenXml.ExcelPackage + Try {$Excel = New-Object -TypeName OfficeOpenXml.ExcelPackage $excel.Load( $Stream,$Password)} Catch { throw "Could not read $Path with the provided password." } } @@ -394,12 +394,13 @@ function Import-Excel { else { #region Create one object per row foreach ($R in $Rows) { - Write-Verbose "Import row '$R'" + #Disabled write-verbose for speed + # Write-Verbose "Import row '$R'" $NewRow = [Ordered]@{} foreach ($P in $PropertyNames) { $NewRow[$P.Value] = $Worksheet.Cells[$R, $P.Column].Value - Write-Verbose "Import cell '$($Worksheet.Cells[$R, $P.Column].Address)' with property name '$($p.Value)' and value '$($Worksheet.Cells[$R, $P.Column].Value)'." + # Write-Verbose "Import cell '$($Worksheet.Cells[$R, $P.Column].Address)' with property name '$($p.Value)' and value '$($Worksheet.Cells[$R, $P.Column].Value)'." } [PSCustomObject]$NewRow diff --git a/__tests__/FunctionAlias.tests.ps1 b/__tests__/FunctionAlias.tests.ps1 index b5d4382..9650d3f 100644 --- a/__tests__/FunctionAlias.tests.ps1 +++ b/__tests__/FunctionAlias.tests.ps1 @@ -1,26 +1,28 @@ #Requires -Modules Pester +remove-module importExcel -erroraction silentlyContinue Import-Module $PSScriptRoot\..\ImportExcel.psd1 -Force + Describe "Check if Function aliases exist" { It "Set-Column should exist" { - Get-Command Set-Column | Should Not Be $null + ${Alias:Set-Column} | Should Not BeNullOrEmpty } It "Set-Row should exist" { - Get-Command Set-Row | Should Not Be $null + ${Alias:Set-Row} | Should Not BeNullOrEmpty } It "Set-Format should exist" { - Get-Command Set-Format | Should Not Be $null + ${Alias:Set-Format} | Should Not BeNullOrEmpty } - It "Merge-MulipleSheets should exist" { + <#It "Merge-MulipleSheets should exist" { Get-Command Merge-MulipleSheets | Should Not Be $null } - +#> It "New-ExcelChart should exist" { - Get-Command New-ExcelChart | Should Not Be $null + ${Alias:New-ExcelChart} | Should Not BeNullOrEmpty } } \ No newline at end of file