mirror of
https://github.com/dfinke/ImportExcel.git
synced 2026-02-20 03:13:38 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -63,3 +63,5 @@ ImportExcel.zip
|
||||
.vscode/settings.json
|
||||
|
||||
~$*
|
||||
InstallModule.ps1
|
||||
PublishToGallery.ps1
|
||||
|
||||
54
Examples/ReadAllSheets/GenerateXlsx.ps1
Normal file
54
Examples/ReadAllSheets/GenerateXlsx.ps1
Normal file
@@ -0,0 +1,54 @@
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
$path
|
||||
)
|
||||
|
||||
$sheet1 = ConvertFrom-Csv @"
|
||||
Region,Item,TotalSold
|
||||
West,melon,27
|
||||
North,avocado,21
|
||||
West,kiwi,84
|
||||
East,melon,23
|
||||
North,kiwi,8
|
||||
North,nail,29
|
||||
North,kiwi,46
|
||||
South,nail,83
|
||||
East,pear,10
|
||||
South,avocado,40
|
||||
"@
|
||||
|
||||
$sheet2 = ConvertFrom-Csv @"
|
||||
Region,Item,TotalSold
|
||||
West,lemon,24
|
||||
North,hammer,41
|
||||
East,nail,87
|
||||
West,lemon,68
|
||||
North,screwdriver,9
|
||||
North,drill,76
|
||||
West,lime,28
|
||||
West,pear,78
|
||||
North,apple,95
|
||||
South,melon,40
|
||||
"@
|
||||
|
||||
$sheet3 = ConvertFrom-Csv @"
|
||||
Region,Item,TotalSold
|
||||
South,drill,100
|
||||
East,saw,22
|
||||
North,saw,5
|
||||
West,orange,78
|
||||
East,saw,27
|
||||
North,screwdriver,57
|
||||
South,hammer,66
|
||||
East,saw,62
|
||||
West,nail,98
|
||||
West,nail,98
|
||||
"@
|
||||
|
||||
Remove-Item $path -ErrorAction SilentlyContinue
|
||||
|
||||
$sheet1 | Export-Excel $path -WorksheetName Sheet1
|
||||
$sheet2 | Export-Excel $path -WorksheetName Sheet2
|
||||
$sheet3 | Export-Excel $xlfile -WorksheetName Sheet3
|
||||
|
||||
$path
|
||||
19
Examples/ReadAllSheets/Get-ExcelSheets.ps1
Normal file
19
Examples/ReadAllSheets/Get-ExcelSheets.ps1
Normal file
@@ -0,0 +1,19 @@
|
||||
# Get-ExcelSheets
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
$path
|
||||
)
|
||||
|
||||
|
||||
$hash = @{ }
|
||||
|
||||
$e = Open-ExcelPackage $path
|
||||
|
||||
foreach ($sheet in $e.workbook.worksheets) {
|
||||
$hash[$sheet.name] = Import-Excel -ExcelPackage $e -WorksheetName $sheet.name
|
||||
}
|
||||
|
||||
Close-ExcelPackage $e -NoSave
|
||||
|
||||
$hash
|
||||
4
Examples/ReadAllSheets/ReadAllSheets.ps1
Normal file
4
Examples/ReadAllSheets/ReadAllSheets.ps1
Normal file
@@ -0,0 +1,4 @@
|
||||
$xlfile = "$env:TEMP\MultipleSheets.xlsx"
|
||||
|
||||
.\GenerateXlsx.ps1 $xlfile
|
||||
.\Get-ExcelSheets.ps1 $xlfile
|
||||
@@ -4,7 +4,7 @@
|
||||
RootModule = 'ImportExcel.psm1'
|
||||
|
||||
# Version number of this module.
|
||||
ModuleVersion = '6.5.0'
|
||||
ModuleVersion = '6.5.2'
|
||||
|
||||
# ID used to uniquely identify this module
|
||||
GUID = '60dd4136-feff-401a-ba27-a84458c57ede'
|
||||
|
||||
@@ -52,6 +52,10 @@ Install-Module ImportExcel -scope CurrentUser
|
||||
Install-Module ImportExcel
|
||||
```
|
||||
|
||||
# What's new 6.5.2
|
||||
|
||||
- Added the example ReadAllSheets.ps1 based on the thread https://github.com/dfinke/ImportExcel/issues/678
|
||||
|
||||
# What's new 6.5.0
|
||||
|
||||
This is now using the latest version of EPPlus. Unit tests are updated and passing, if you hit problems, please open an issue.
|
||||
|
||||
Reference in New Issue
Block a user