mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-16 16:24:03 +00:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
09f35b5fd5 | ||
|
|
23a2ac394f | ||
|
|
50928e8e3b | ||
|
|
26827b0764 | ||
|
|
6c35d5b018 | ||
|
|
ab5600c9ba | ||
|
|
47dcc636d9 | ||
|
|
1768c0ac92 | ||
|
|
694fcdd8c1 | ||
|
|
0192f4d822 |
@@ -6,7 +6,7 @@
|
|||||||
RootModule = 'ImportExcel.psm1'
|
RootModule = 'ImportExcel.psm1'
|
||||||
|
|
||||||
# Version number of this module.
|
# Version number of this module.
|
||||||
ModuleVersion = '7.2.1'
|
ModuleVersion = '7.3.0'
|
||||||
|
|
||||||
# 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'
|
||||||
|
|||||||
@@ -35,7 +35,12 @@
|
|||||||
if ($pkgobj) {
|
if ($pkgobj) {
|
||||||
foreach ($w in $pkgobj.Workbook.Worksheets) {
|
foreach ($w in $pkgobj.Workbook.Worksheets) {
|
||||||
$sb = [scriptblock]::Create(('$this.workbook.Worksheets["{0}"]' -f $w.name))
|
$sb = [scriptblock]::Create(('$this.workbook.Worksheets["{0}"]' -f $w.name))
|
||||||
Add-Member -InputObject $pkgobj -MemberType ScriptProperty -Name $w.name -Value $sb
|
try {
|
||||||
|
Add-Member -InputObject $pkgobj -MemberType ScriptProperty -Name $w.name -Value $sb -ErrorAction Stop
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Warning "Could not add sheet $($w.name) as 'short cut', you need to access it via `$wb.Worksheets['$($w.name)'] "
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $pkgobj
|
return $pkgobj
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#Requires -Version 5
|
||||||
function Read-Clipboard {
|
function Read-Clipboard {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
@@ -22,9 +23,11 @@ function Read-Clipboard {
|
|||||||
$Header
|
$Header
|
||||||
)
|
)
|
||||||
|
|
||||||
if ($IsWindows) {
|
if ($IsLinux -or $IsMacOS) {
|
||||||
$osInfo = Get-CimInstance -ClassName Win32_OperatingSystem
|
Write-Error "Read-Clipboard only runs on Windows"
|
||||||
if ($osInfo.ProductType -eq 1) {
|
return
|
||||||
|
}
|
||||||
|
|
||||||
$cvtParams = @{
|
$cvtParams = @{
|
||||||
Data = Get-Clipboard -Raw
|
Data = Get-Clipboard -Raw
|
||||||
}
|
}
|
||||||
@@ -39,14 +42,6 @@ function Read-Clipboard {
|
|||||||
|
|
||||||
ReadClipboardImpl @cvtParams
|
ReadClipboardImpl @cvtParams
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
Write-Error "This command is only supported on the desktop."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Write-Error "This function is only available on Windows desktop"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function ReadClipboardImpl {
|
function ReadClipboardImpl {
|
||||||
param(
|
param(
|
||||||
|
|||||||
39
__tests__/Open-ExcelPackage.tests.ps1
Normal file
39
__tests__/Open-ExcelPackage.tests.ps1
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#Requires -Modules Pester
|
||||||
|
|
||||||
|
if (-not (Get-command Import-Excel -ErrorAction SilentlyContinue)) {
|
||||||
|
Import-Module $PSScriptRoot\..\ImportExcel.psd1
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
Methods
|
||||||
|
-------
|
||||||
|
Dispose
|
||||||
|
Equals
|
||||||
|
GetAsByteArray
|
||||||
|
GetHashCode
|
||||||
|
GetType
|
||||||
|
Load
|
||||||
|
Save
|
||||||
|
SaveAs
|
||||||
|
ToString
|
||||||
|
|
||||||
|
Properties
|
||||||
|
----------
|
||||||
|
|
||||||
|
Compatibility
|
||||||
|
Compression
|
||||||
|
DoAdjustDrawings
|
||||||
|
Encryption
|
||||||
|
File
|
||||||
|
Package
|
||||||
|
Stream
|
||||||
|
Workbook
|
||||||
|
#>
|
||||||
|
|
||||||
|
Describe "Test Open Excel Package" -Tag Open-ExcelPackage {
|
||||||
|
It "Should handle opening a workbook with Worksheet Names that will cause errors" {
|
||||||
|
$xlFilename = "$PSScriptRoot\UnsupportedWorkSheetNames.xlsx"
|
||||||
|
|
||||||
|
{ Open-ExcelPackage -Path $xlFilename -ErrorAction Stop } | Should -Not -Throw
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
__tests__/UnsupportedWorkSheetNames.xlsx
Normal file
BIN
__tests__/UnsupportedWorkSheetNames.xlsx
Normal file
Binary file not shown.
12
changelog.md
12
changelog.md
@@ -1,7 +1,19 @@
|
|||||||
|
# v7.3.0
|
||||||
|
|
||||||
|
- Fix throwing error when a Worksheet name collides with a method, or property name on the `OfficeOpenXml.ExcelPackage` package
|
||||||
|
|
||||||
|
# v7.2.3
|
||||||
|
|
||||||
|
- Fix inline help, thank you [Wes Stahler](https://github.com/stahler)
|
||||||
|
|
||||||
|
# v7.2.2
|
||||||
|
|
||||||
|
- Improved checks for Linux, Mac and PS 5.1
|
||||||
|
|
||||||
# v7.2.1
|
# v7.2.1
|
||||||
|
|
||||||
- Improve auto-detection of data on the clipboard
|
- Improve auto-detection of data on the clipboard
|
||||||
|
|
||||||
# v7.2.0
|
# v7.2.0
|
||||||
|
|
||||||
- Added `Read-Clipboard` support for Windows. Read text from clipboard. It can read CSV or JSON. Plus, you can specify the delimiter and headers.
|
- Added `Read-Clipboard` support for Windows. Read text from clipboard. It can read CSV or JSON. Plus, you can specify the delimiter and headers.
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ schema: 2.0.0
|
|||||||
|
|
||||||
## SYNOPSIS
|
## SYNOPSIS
|
||||||
|
|
||||||
Returns an ExcelPackage object for the specified XLSX fil.e
|
Returns an ExcelPackage object for the specified XLSX file.
|
||||||
|
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user