mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-15 15:53:32 +00:00
Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8bb3d50052 | ||
|
|
d5b807d3cb | ||
|
|
e2053e4998 | ||
|
|
8c6c7eeaf6 | ||
|
|
31abd215dc | ||
|
|
cafaafd53d | ||
|
|
ee3c8e7680 | ||
|
|
0b207548e0 | ||
|
|
6628b55ce5 | ||
|
|
f6bfabd96a | ||
|
|
980631df8b | ||
|
|
4f9b83f0e6 | ||
|
|
59cf89b451 | ||
|
|
5777d907c4 | ||
|
|
d7c516d35e | ||
|
|
27d69e7531 | ||
|
|
8ae92fba54 | ||
|
|
aa0f0cf4e2 | ||
|
|
6e38d97498 | ||
|
|
ef7c8331f5 | ||
|
|
267d15f99a | ||
|
|
390aca0496 | ||
|
|
4fa34ae257 | ||
|
|
0b3b382c4e | ||
|
|
415be5bca3 |
23
Examples/CustomNumbers/ShortenNumbers.ps1
Normal file
23
Examples/CustomNumbers/ShortenNumbers.ps1
Normal file
@@ -0,0 +1,23 @@
|
||||
# How to convert abbreviate or shorten long numbers in Excel
|
||||
|
||||
Remove-Item .\custom.xlsx -ErrorAction SilentlyContinue
|
||||
|
||||
$data = $(
|
||||
12000
|
||||
1000
|
||||
2000
|
||||
3000
|
||||
2400
|
||||
3600
|
||||
6000
|
||||
13000
|
||||
40000
|
||||
400000
|
||||
1000000
|
||||
)
|
||||
|
||||
$excel = $data | Export-Excel .\custom.xlsx -PassThru
|
||||
|
||||
Set-ExcelRange -Worksheet $excel.Sheet1 -Range "A:A" -NumberFormat '[>999999]#,,"M";#,"K"'
|
||||
|
||||
Close-ExcelPackage $excel -Show
|
||||
@@ -2,6 +2,6 @@ Import-Module $PSScriptRoot\..\..\ImportExcel.psd1 -Force
|
||||
|
||||
$xlfile = "$PSScriptRoot\yearlySales.xlsx"
|
||||
|
||||
$result = Import-Excel -Path $xlfile -WorksheetName * -NotAsDictionary
|
||||
$result = Import-Excel -Path $xlfile -WorksheetName * -Raw
|
||||
|
||||
$result | Measure-Object
|
||||
@@ -6,7 +6,7 @@
|
||||
RootModule = 'ImportExcel.psm1'
|
||||
|
||||
# Version number of this module.
|
||||
ModuleVersion = '7.5.1'
|
||||
ModuleVersion = '7.5.3'
|
||||
|
||||
# ID used to uniquely identify this module
|
||||
GUID = '60dd4136-feff-401a-ba27-a84458c57ede'
|
||||
@@ -131,9 +131,8 @@ Check out the How To Videos https://www.youtube.com/watch?v=U3Ne_yX4tYo&list=PL5
|
||||
'.\Charting\Charting.ps1',
|
||||
'.\InferData\InferData.ps1',
|
||||
'.\Pivot\Pivot.ps1',
|
||||
'.\spikes\ConvertFrom-ExcelColumnName.ps1',
|
||||
'.\Examples', '.\images', '.\Testimonials'
|
||||
|
||||
'.\Examples',
|
||||
'.\Testimonials'
|
||||
)
|
||||
|
||||
# Private data to pass to the module specified in RootModule/ModuleToProcess
|
||||
|
||||
@@ -7,5 +7,5 @@ if (-not $fullPath) {
|
||||
$fullPath = Join-Path $fullPath -ChildPath "ImportExcel"
|
||||
}
|
||||
Push-location $PSScriptRoot
|
||||
Robocopy . $fullPath /mir /XD .vscode .git CI __tests__ data mdHelp /XF appveyor.yml azure-pipelines.yml .gitattributes .gitignore filelist.txt install.ps1 InstallModule.ps1
|
||||
Robocopy . $fullPath /mir /XD .vscode images .git .github CI __tests__ data mdHelp spikes /XF README.md README.original.md appveyor.yml azure-pipelines.yml .gitattributes .gitignore filelist.txt install.ps1 InstallModule.ps1 PublishToGallery.ps1
|
||||
Pop-Location
|
||||
@@ -37,7 +37,7 @@
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$Password,
|
||||
[Int[]]$ImportColumns,
|
||||
[Switch]$NotAsDictionary
|
||||
[Switch]$Raw
|
||||
)
|
||||
end {
|
||||
$sw = [System.Diagnostics.Stopwatch]::StartNew()
|
||||
@@ -239,7 +239,7 @@
|
||||
# $EndColumn = 0
|
||||
if ($Path) { $stream.close(); $ExcelPackage.Dispose() }
|
||||
|
||||
if ($NotAsDictionary) {
|
||||
if ($Raw) {
|
||||
foreach ($entry in $xlbook.GetEnumerator()) {
|
||||
$entry.Value
|
||||
}
|
||||
|
||||
1248
README.original.md
Normal file
1248
README.original.md
Normal file
File diff suppressed because it is too large
Load Diff
@@ -50,7 +50,7 @@ Describe 'Different ways to import sheets' -Tag ImportExcelReadSheets {
|
||||
}
|
||||
|
||||
It 'Should return an array not a dictionary' {
|
||||
$actual = Import-Excel $xlFilename april, june -NotAsDictionary
|
||||
$actual = Import-Excel $xlFilename april, june -Raw
|
||||
|
||||
$actual.Count | Should -Be 200
|
||||
$group = $actual | Group-Object month -NoElement
|
||||
@@ -69,5 +69,14 @@ Describe 'Different ways to import sheets' -Tag ImportExcelReadSheets {
|
||||
$actual["2015"].Count | Should -Be 12
|
||||
$actual["2016"].Count | Should -Be 1
|
||||
}
|
||||
|
||||
It "Should read multiple sheets with diff number of rows correctly and flatten it" {
|
||||
$xlFilename = "$PSScriptRoot\construction.xlsx"
|
||||
|
||||
$actual = Import-Excel $xlFilename 2015, 2016 -Raw
|
||||
|
||||
$actual.Count | Should -Be 13
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
# v7.5.2
|
||||
- Changed the switch `-NotAsDictionary` to `-Raw`. Works with `-Worksheetname *` reads all the sheets in the xlsx file and returns an array.
|
||||
|
||||
# v7.5.1
|
||||
- Fixed `Import-Excel` - Reset `EndRow` and `EndColumn` in the correct place.
|
||||
# v7.5.0
|
||||
|
||||
BIN
images/SalesData.png
Normal file
BIN
images/SalesData.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
BIN
images/SalesDataChart.png
Normal file
BIN
images/SalesDataChart.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
BIN
images/SalesDataChartPivotTable.png
Normal file
BIN
images/SalesDataChartPivotTable.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 238 KiB |
BIN
images/logo.png
Normal file
BIN
images/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
BIN
images/logoWithInstall.png
Normal file
BIN
images/logoWithInstall.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
Reference in New Issue
Block a user