Skip to content

Commit

Permalink
Merge pull request #1591 from pbossman/master
Browse files Browse the repository at this point in the history
Resolve worksheet ArgumentCompleter Fixes:#1590
  • Loading branch information
dfinke committed May 3, 2024
2 parents c1b395f + 53712d4 commit 74cbca8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ImportExcel.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
RootModule = 'ImportExcel.psm1'

# Version number of this module.
ModuleVersion = '7.8.6'
ModuleVersion = '7.8.7'

# ID used to uniquely identify this module
GUID = '60dd4136-feff-401a-ba27-a84458c57ede'
Expand Down
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
8 changes: 8 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# 7.8.7

- Thanks to [Phil Bossman](https://github.com/pbossman) for the PR and fixing this.

Now, back again, you can type `Import-Excel .\yearlySales.xlsx`, press <ctrl+space> and get a list of the worksheets in the Excel file

![alt text](images/AutoCompleteSheetNames.png)

# Infrastructure change

- Thank you to [RipFence](https://github.com/RipFence) who asked how to place a chart on a different sheet from the data and then did a PR adding the example.
Expand Down
Binary file added images/AutoCompleteSheetNames.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 74cbca8

Please sign in to comment.