Compare commits

..

1 Commits

Author SHA1 Message Date
dfinke
16e2319124 WIP https://github.com/dfinke/ImportExcel/issues/1587 2024-04-17 09:17:46 -04:00
5 changed files with 12 additions and 30 deletions

View File

@@ -6,7 +6,7 @@
RootModule = 'ImportExcel.psm1' RootModule = 'ImportExcel.psm1'
# Version number of this module. # Version number of this module.
ModuleVersion = '7.8.10' ModuleVersion = '7.8.6'
# ID used to uniquely identify this module # ID used to uniquely identify this module
GUID = '60dd4136-feff-401a-ba27-a84458c57ede' GUID = '60dd4136-feff-401a-ba27-a84458c57ede'
@@ -150,7 +150,7 @@ Check out the How To Videos https://www.youtube.com/watch?v=U3Ne_yX4tYo&list=PL5
Tags = @("Excel", "EPPlus", "Export", "Import") Tags = @("Excel", "EPPlus", "Export", "Import")
# The web address of an icon which can be used in galleries to represent this module # The web address of an icon which can be used in galleries to represent this module
#IconUri = #IconUri = "http://pesterbdd.com/images/Pester.png"
# The web address of this module's project or support homepage. # The web address of this module's project or support homepage.
ProjectUri = "https://github.com/dfinke/ImportExcel" ProjectUri = "https://github.com/dfinke/ImportExcel"
@@ -215,4 +215,4 @@ Check out the How To Videos https://www.youtube.com/watch?v=U3Ne_yX4tYo&list=PL5
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = '' # DefaultCommandPrefix = ''
} }

View File

@@ -67,8 +67,9 @@ function WorksheetArgumentCompleter {
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
$xlPath = $fakeBoundParameter['Path'] $xlPath = $fakeBoundParameter['Path']
if (Test-Path -Path $xlPath) { if (Test-Path -Path $xlPath) {
$xlSheet = Get-ExcelSheetInfo -Path $xlPath $xlpkg = Open-ExcelPackage -ReadOnly -Path $xlPath
$WorksheetNames = $xlSheet.Name $WorksheetNames = $xlPkg.Workbook.Worksheets.Name
Close-ExcelPackage -nosave -ExcelPackage $xlpkg
$WorksheetNames.where( { $_ -like "*$wordToComplete*" }) | foreach-object { $WorksheetNames.where( { $_ -like "*$wordToComplete*" }) | foreach-object {
New-Object -TypeName System.Management.Automation.CompletionResult -ArgumentList "'$_'", New-Object -TypeName System.Management.Automation.CompletionResult -ArgumentList "'$_'",
$_ , ([System.Management.Automation.CompletionResultType]::ParameterValue) , $_ $_ , ([System.Management.Automation.CompletionResultType]::ParameterValue) , $_

View File

@@ -45,18 +45,11 @@ function ConvertTo-ExcelXlsx {
throw "Could not create Excel.Application ComObject. Please verify that Excel is installed." throw "Could not create Excel.Application ComObject. Please verify that Excel is installed."
} }
try { $Excel.Visible = $false
$Excel.Visible = $false $null = $Excel.Workbooks.Open($xlsFile.FullName)
$null = $Excel.Workbooks.Open($xlsFile.FullName, $null, $true) $Excel.ActiveWorkbook.SaveAs($xlsxPath, $xlFixedFormat)
$Excel.ActiveWorkbook.SaveAs($xlsxPath, $xlFixedFormat) $Excel.ActiveWorkbook.Close()
} $Excel.Quit()
finally {
if ($null -ne $Excel.ActiveWorkbook) {
$Excel.ActiveWorkbook.Close()
}
$Excel.Quit()
}
} }
} }

View File

@@ -1,18 +1,6 @@
# 7.8.9
- Thanks to (Edward Miller)[https://github.com/edwardmiller-mesirow] for improving `ConvertTo-ExcelXlsx`and making it more robust
# 7.8.8
- Fix the release
# 7.8.7 # 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 # Infrastructure change

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB