Skip to content

Commit

Permalink
Resolve worksheet argumentcompleter Fixes:#1590
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-bossman committed Apr 30, 2024
1 parent c1b395f commit efa73b3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Private/ArgumentCompletion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,8 @@ function WorksheetArgumentCompleter {
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
$xlPath = $fakeBoundParameter['Path']
if (Test-Path -Path $xlPath) {
$xlpkg = Open-ExcelPackage -ReadOnly -Path $xlPath
$WorksheetNames = $xlPkg.Workbook.Worksheets.Name
Close-ExcelPackage -nosave -ExcelPackage $xlpkg
$xlSheet = Get-ExcelSheetInfo -Path $xlPath
$WorksheetNames = $xlSheet.Name
$WorksheetNames.where( { $_ -like "*$wordToComplete*" }) | foreach-object {
New-Object -TypeName System.Management.Automation.CompletionResult -ArgumentList "'$_'",
$_ , ([System.Management.Automation.CompletionResultType]::ParameterValue) , $_
Expand Down

0 comments on commit efa73b3

Please sign in to comment.