mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-15 15:53:32 +00:00
Compare commits
92 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ca870a889 | ||
|
|
a320cfd28c | ||
|
|
aa1b042767 | ||
|
|
7e8416d67c | ||
|
|
229b60b25d | ||
|
|
5700989321 | ||
|
|
56e1704e7e | ||
|
|
8268bbc2e1 | ||
|
|
5657659331 | ||
|
|
0d4a32e266 | ||
|
|
1c8f8d2a3d | ||
|
|
f6a65677df | ||
|
|
86a7865fb2 | ||
|
|
8b3bf4f14f | ||
|
|
4d6193f549 | ||
|
|
6ebac7b6dc | ||
|
|
d71dd36d56 | ||
|
|
3697cdfeee | ||
|
|
1e172cf21f | ||
|
|
6da7553c98 | ||
|
|
5a444c620b | ||
|
|
4a09fc3570 | ||
|
|
d706a10276 | ||
|
|
1fd2f422cd | ||
|
|
283e50547d | ||
|
|
15211a6297 | ||
|
|
8905b8d401 | ||
|
|
e9b437af4e | ||
|
|
330e237727 | ||
|
|
c56b2cd33a | ||
|
|
1aa5c6da45 | ||
|
|
9eb894cf59 | ||
|
|
3a4c2d7bd9 | ||
|
|
42cb5a316a | ||
|
|
536cdaa841 | ||
|
|
6cd9fad7ba | ||
|
|
829d854c3d | ||
|
|
b33a282740 | ||
|
|
73fc96166c | ||
|
|
00f7278115 | ||
|
|
956cf5aa49 | ||
|
|
877310e015 | ||
|
|
08bf877535 | ||
|
|
88e28a1d6c | ||
|
|
eb63fe259a | ||
|
|
6d97efc5c2 | ||
|
|
c567526eac | ||
|
|
ed210cc730 | ||
|
|
72f44ebcb9 | ||
|
|
f1d20ed163 | ||
|
|
02cf6bb3f3 | ||
|
|
5cd3897dfa | ||
|
|
fe4f2848ad | ||
|
|
4e89b3321a | ||
|
|
43b6ebf84f | ||
|
|
1ee9493bc0 | ||
|
|
8f0fc7397d | ||
|
|
4fa6fbda01 | ||
|
|
7177623104 | ||
|
|
487cf51abc | ||
|
|
ae31e9d39b | ||
|
|
9ba20b8ec8 | ||
|
|
9daefc2925 | ||
|
|
f0b4cb28f6 | ||
|
|
5f00f5cbbc | ||
|
|
d41fbf8a05 | ||
|
|
ebe49f1650 | ||
|
|
a3dced10e4 | ||
|
|
1e522c562b | ||
|
|
5ec299ff2d | ||
|
|
676ecc17e0 | ||
|
|
aa1b0018ab | ||
|
|
eabaab79c5 | ||
|
|
7a8bbb9771 | ||
|
|
85f2433ffc | ||
|
|
62c8d74a59 | ||
|
|
5e7b404daf | ||
|
|
91a1240408 | ||
|
|
e8c3d96f43 | ||
|
|
9417b25af1 | ||
|
|
a942f2133d | ||
|
|
533ed07ac8 | ||
|
|
09f35b5fd5 | ||
|
|
23a2ac394f | ||
|
|
50928e8e3b | ||
|
|
26827b0764 | ||
|
|
6c35d5b018 | ||
|
|
ab5600c9ba | ||
|
|
47dcc636d9 | ||
|
|
1768c0ac92 | ||
|
|
694fcdd8c1 | ||
|
|
0192f4d822 |
9
Examples/ImportColumns/ImportColumns.ps1
Normal file
9
Examples/ImportColumns/ImportColumns.ps1
Normal file
@@ -0,0 +1,9 @@
|
||||
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
|
||||
|
||||
# Create example file
|
||||
$xlFile = "$PSScriptRoot\ImportColumns.xlsx"
|
||||
Get-Process | Export-Excel -Path $xlFile
|
||||
# -ImportColumns will also arrange columns
|
||||
Import-Excel -Path $xlFile -ImportColumns @(1,3,2) -NoHeader -StartRow 1
|
||||
# Get only pm, npm, cpu, id, processname
|
||||
Import-Excel -Path $xlFile -ImportColumns @(6,7,12,25,46) | Format-Table -AutoSize
|
||||
14
Examples/InvokeExcelQuery/Examples.ps1
Normal file
14
Examples/InvokeExcelQuery/Examples.ps1
Normal file
@@ -0,0 +1,14 @@
|
||||
try { Import-Module $PSScriptRoot\..\..\ImportExcel.psd1 } catch { throw ; return }
|
||||
|
||||
$queries =
|
||||
'select * from [sheet1$A:A]',
|
||||
'select * from [sheet1$]',
|
||||
'select * from [sheet1$A2:E11]',
|
||||
'select F2,F5 from [sheet1$A2:E11]',
|
||||
'select * from [sheet1$A2:E11] where F2 = "Grocery"',
|
||||
'select F2 as [Category], F5 as [Discount], F5*2 as [DiscountPlus] from [sheet1$A2:E11]'
|
||||
|
||||
foreach ($query in $queries) {
|
||||
"query: $($query)"
|
||||
Invoke-ExcelQuery .\testOleDb.xlsx $query | Format-Table
|
||||
}
|
||||
BIN
Examples/InvokeExcelQuery/testOleDb.xlsx
Normal file
BIN
Examples/InvokeExcelQuery/testOleDb.xlsx
Normal file
Binary file not shown.
6
FAQ/How to Create an Empty Excel File.md
Normal file
6
FAQ/How to Create an Empty Excel File.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Create an Empty Excel File
|
||||
Use an empty string to export to an excel file.
|
||||
```powershell
|
||||
#Build an Excel file named: "file.xlsx" containing a worksheet: "MyWorksheet"
|
||||
"" | Export-Excel -Path "C:\Test\file.xlsx" -WorksheetName "MyWorksheet"
|
||||
```
|
||||
41
FAQ/How to Read an Existing Excel File.md
Normal file
41
FAQ/How to Read an Existing Excel File.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# How to Read an Existing Excel File
|
||||
## Enumerate the Excel File Contents
|
||||
```powershell
|
||||
#Load the Excel file into a PSCustomObject
|
||||
$ExcelFile = Import-Excel "C:\Test\file.xlsx" -WorksheetName "Sheet1"
|
||||
```
|
||||
|
||||
## Visual of Data Structure
|
||||
The File C:\Test\file.xlsx contains
|
||||

|
||||
|
||||
After loading this data into ```$ExcelFile``` the data is stored like:
|
||||

|
||||
|
||||
## Other Common Operations
|
||||
|
||||
### Load a Column
|
||||
```powershell
|
||||
$SpecificColumn = $ExcelFile."anotherHeader" #loads column with the header "anotherHeader" -- data stored in an array
|
||||
```
|
||||
|
||||
### Load a Row
|
||||
```powershell
|
||||
$SpecificRow = $ExcelFile[1] #Loads row at index 1. Index 1 is the first row instead of 0.
|
||||
```
|
||||
|
||||
### Map Contents to Hashtable to Interpret Data
|
||||
Sometimes mapping to a Hashtable is more convenient to have access to common Hashtable operations. Enumerate a Hashtable with the row's data by:
|
||||
```powershell
|
||||
$HashTable = @{}
|
||||
$SpecificRow= $ExcelFile[2]
|
||||
$SpecificRow.psobject.properties | ForEach-Object {
|
||||
$HashTable[$_.Name] = $_.Value
|
||||
}
|
||||
```
|
||||
To then iterate through the enumerated Hashtable:
|
||||
```powershell
|
||||
ForEach ($Key in ($HashTable.GetEnumerator()) | Where-Object {$_.Value -eq "x"}){ #Only grabs a key where the value is "x"
|
||||
#values accessible with $Key.Name or $Key.Value
|
||||
}
|
||||
```
|
||||
34
FAQ/How to Write to an Existing Excel File.md
Normal file
34
FAQ/How to Write to an Existing Excel File.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# Write to an Existing Excel File
|
||||
### Enumerate the Excel File
|
||||
The cmdlets ```Open-ExcelPackage``` and ```Close-ExcelPackage``` allow for direct modification to Excel file contents.
|
||||
```powershell
|
||||
$ExcelPkg = Open-ExcelPackage -Path "C:\Test\file.xlsx"
|
||||
```
|
||||
Contents of file.xlsx:
|
||||

|
||||
### Enumerate the Worksheet to View or Modify the Data
|
||||
```powershell
|
||||
$WorkSheet = $ExcelPkg.Workbook.Worksheets["sheet1"].Cells #open excel worksheet cells from worksheet "sheet1"
|
||||
```
|
||||
Visual of data structure:
|
||||

|
||||
A1 contains "someHeader", A2 contains "data1" etc.
|
||||
### Modify a Specific Value in a File
|
||||
Values can be accessed by row, column. Similar to a 2D array.
|
||||
```powershell
|
||||
$WorkSheet[1,4].Value = "New Column Header" #Starts at index 1 not 0
|
||||
```
|
||||
Contents of file.xlsx after modifying:
|
||||

|
||||
### Load Value at Specific Index
|
||||
```powershell
|
||||
$ValueAtIndex = $WorkSheet[2,1].Value #Loads the value at row 2, column A
|
||||
```
|
||||
```$ValueAtIndex``` now contains: 
|
||||
### Save File After Modifying
|
||||
The changes will not display in the Excel file until Close-ExcelPackage is called.
|
||||
```powershell
|
||||
Close-ExcelPackage $ExcelPkg #close and save changes made to the Excel file.
|
||||
```
|
||||
**Note**: If the file is currently in use, Close-ExcelPackage will return an error and will not save the information.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
RootModule = 'ImportExcel.psm1'
|
||||
|
||||
# Version number of this module.
|
||||
ModuleVersion = '7.2.1'
|
||||
ModuleVersion = '7.4.1'
|
||||
|
||||
# ID used to uniquely identify this module
|
||||
GUID = '60dd4136-feff-401a-ba27-a84458c57ede'
|
||||
@@ -64,6 +64,7 @@ Check out the How To Videos https://www.youtube.com/watch?v=U3Ne_yX4tYo&list=PL5
|
||||
'Import-USPS',
|
||||
'Invoke-AllTests',
|
||||
'Invoke-Sum',
|
||||
'Invoke-ExcelQuery',
|
||||
'Join-Worksheet',
|
||||
'LineChart',
|
||||
'Merge-MultipleSheets',
|
||||
@@ -80,6 +81,7 @@ Check out the How To Videos https://www.youtube.com/watch?v=U3Ne_yX4tYo&list=PL5
|
||||
'Pivot',
|
||||
'Read-Clipboard',
|
||||
'ReadClipboardImpl',
|
||||
'Read-OleDbData',
|
||||
'Remove-Worksheet',
|
||||
'Select-Worksheet',
|
||||
'Send-SQLDataToExcel',
|
||||
|
||||
25
Private/Invoke-ExcelReZipFile.ps1
Normal file
25
Private/Invoke-ExcelReZipFile.ps1
Normal file
@@ -0,0 +1,25 @@
|
||||
function Invoke-ExcelReZipFile {
|
||||
<#
|
||||
#>
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[OfficeOpenXml.ExcelPackage]$ExcelPackage
|
||||
)
|
||||
|
||||
Write-Verbose -Message "Re-Zipping $($ExcelPackage.file) using .NET ZIP library"
|
||||
try {
|
||||
Add-Type -AssemblyName 'System.IO.Compression.Filesystem' -ErrorAction stop
|
||||
}
|
||||
catch {
|
||||
Write-Error "The -ReZip parameter requires .NET Framework 4.5 or later to be installed. Recommend to install Powershell v4+"
|
||||
continue
|
||||
}
|
||||
try {
|
||||
$TempZipPath = Join-Path -Path ([System.IO.Path]::GetTempPath()) -ChildPath ([System.IO.Path]::GetRandomFileName())
|
||||
$null = [io.compression.zipfile]::ExtractToDirectory($ExcelPackage.File, $TempZipPath)
|
||||
Remove-Item $ExcelPackage.File -Force
|
||||
$null = [io.compression.zipfile]::CreateFromDirectory($TempZipPath, $ExcelPackage.File)
|
||||
Remove-Item $TempZipPath -Recurse -Force
|
||||
}
|
||||
catch { throw "Error resizipping $path : $_" }
|
||||
}
|
||||
@@ -4,13 +4,15 @@ function Close-ExcelPackage {
|
||||
param (
|
||||
[parameter(Mandatory = $true, ValueFromPipeline = $true)]
|
||||
[OfficeOpenXml.ExcelPackage]$ExcelPackage,
|
||||
[switch]$Show,
|
||||
[Switch]$Show,
|
||||
[Switch]$NoSave,
|
||||
$SaveAs,
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$Password,
|
||||
[switch]$Calculate
|
||||
[Switch]$Calculate,
|
||||
[Switch]$ReZip
|
||||
)
|
||||
|
||||
if ( $NoSave) { $ExcelPackage.Dispose() }
|
||||
else {
|
||||
if ($Calculate) {
|
||||
@@ -27,6 +29,9 @@ function Close-ExcelPackage {
|
||||
else { $ExcelPackage.Save() }
|
||||
$SaveAs = $ExcelPackage.File.FullName
|
||||
}
|
||||
if ($ReZip) {
|
||||
Invoke-ExcelReZipFile -ExcelPackage $ExcelPackage
|
||||
}
|
||||
$ExcelPackage.Dispose()
|
||||
if ($Show) { Start-Process -FilePath $SaveAs }
|
||||
}
|
||||
|
||||
@@ -253,7 +253,8 @@
|
||||
else { $firstTimeThru = $true }
|
||||
}
|
||||
|
||||
process { if ($PSBoundParameters.ContainsKey("InputObject")) {
|
||||
process {
|
||||
if ($PSBoundParameters.ContainsKey("InputObject")) {
|
||||
try {
|
||||
if ($null -eq $InputObject) { $row += 1 }
|
||||
foreach ($TargetData in $InputObject) {
|
||||
@@ -321,7 +322,8 @@
|
||||
$ws.Cells[$row, $ColumnIndex].Style.Font.Color.SetColor([System.Drawing.Color]::Blue)
|
||||
$ws.Cells[$row, $ColumnIndex].Style.Font.UnderLine = $true
|
||||
}
|
||||
elseif ($v -isnot [String] ) { #Other objects or null.
|
||||
elseif ($v -isnot [String] ) {
|
||||
#Other objects or null.
|
||||
if ($null -ne $v) { $ws.Cells[$row, $ColumnIndex].Value = $v.toString() }
|
||||
}
|
||||
elseif ($v[0] -eq '=') {
|
||||
@@ -362,7 +364,8 @@
|
||||
}
|
||||
}
|
||||
catch { throw "Failed exporting data to worksheet '$WorksheetName' to '$Path': $_" }
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
end {
|
||||
if ($firstTimeThru -and $ws.Dimension) {
|
||||
@@ -386,7 +389,8 @@
|
||||
$headerRange = $ws.Dimension.Address -replace "\d+$", $StartRow
|
||||
#using a slightly odd syntax otherwise header ends up as a 2D array
|
||||
$ws.Cells[$headerRange].Value | ForEach-Object -Begin { $Script:header = @() } -Process { $Script:header += $_ }
|
||||
if ($PSBoundParameters.ContainsKey($TargetData)) { #if Export was called with data that writes no header start the range at $startRow ($startRow is data)
|
||||
if ($PSBoundParameters.ContainsKey($TargetData)) {
|
||||
#if Export was called with data that writes no header start the range at $startRow ($startRow is data)
|
||||
$targetRow = $StartRow
|
||||
}
|
||||
else { $targetRow = $StartRow + 1 } #if Export was called without data to add names (assume $startRow is a header) or...
|
||||
@@ -400,7 +404,8 @@
|
||||
foreach ($c in 0..($LastCol - $StartColumn)) {
|
||||
$targetRangeName = @($script:Header)[$c] #Let Add-ExcelName fix (and warn about) bad names
|
||||
Add-ExcelName -RangeName $targetRangeName -Range $ws.Cells[$targetRow, ($StartColumn + $c ), $LastRow, ($StartColumn + $c )]
|
||||
try {#this test can throw with some names, surpress any error
|
||||
try {
|
||||
#this test can throw with some names, surpress any error
|
||||
if ([OfficeOpenXml.FormulaParsing.ExcelUtilities.ExcelAddressUtil]::IsValidAddress(($targetRangeName -replace '\W' , '_' ))) {
|
||||
Write-Warning -Message "AutoNameRange: Property name '$targetRangeName' is also a valid Excel address and may cause issues. Consider renaming the property."
|
||||
}
|
||||
@@ -515,7 +520,8 @@
|
||||
}
|
||||
catch { Write-Warning -Message "Failed adding Freezing the panes in worksheet '$WorksheetName': $_" }
|
||||
|
||||
if ($PSBoundParameters.ContainsKey("BoldTopRow")) { #it sets bold as far as there are populated cells: for whole row could do $ws.row($x).style.font.bold = $true
|
||||
if ($PSBoundParameters.ContainsKey("BoldTopRow")) {
|
||||
#it sets bold as far as there are populated cells: for whole row could do $ws.row($x).style.font.bold = $true
|
||||
try {
|
||||
if ($Title) {
|
||||
$range = $ws.Dimension.Address -replace '\d+', ($StartRow + 1)
|
||||
@@ -621,7 +627,8 @@
|
||||
if ($c.ConditionalType) {
|
||||
$cfParams = @{RuleType = $c.ConditionalType; ConditionValue = $c.Text ;
|
||||
BackgroundColor = $c.BackgroundColor; BackgroundPattern = $c.PatternType ;
|
||||
ForeGroundColor = $c.ConditionalTextColor}
|
||||
ForeGroundColor = $c.ConditionalTextColor
|
||||
}
|
||||
if ($c.Range) { $cfParams.Range = $c.Range }
|
||||
else { $cfParams.Range = $ws.Dimension.Address }
|
||||
Add-ConditionalFormatting -Worksheet $ws @cfParams
|
||||
@@ -672,21 +679,7 @@
|
||||
else { $pkg.Save() }
|
||||
Write-Verbose -Message "Saved workbook $($pkg.File)"
|
||||
if ($ReZip) {
|
||||
Write-Verbose -Message "Re-Zipping $($pkg.file) using .NET ZIP library"
|
||||
try {
|
||||
Add-Type -AssemblyName 'System.IO.Compression.Filesystem' -ErrorAction stop
|
||||
}
|
||||
catch {
|
||||
Write-Error "The -ReZip parameter requires .NET Framework 4.5 or later to be installed. Recommend to install Powershell v4+"
|
||||
continue
|
||||
}
|
||||
try {
|
||||
$TempZipPath = Join-Path -Path ([System.IO.Path]::GetTempPath()) -ChildPath ([System.IO.Path]::GetRandomFileName())
|
||||
$null = [io.compression.zipfile]::ExtractToDirectory($pkg.File, $TempZipPath)
|
||||
Remove-Item $pkg.File -Force
|
||||
$null = [io.compression.zipfile]::CreateFromDirectory($TempZipPath, $pkg.File)
|
||||
}
|
||||
catch {throw "Error resizipping $path : $_"}
|
||||
Invoke-ExcelReZipFile -ExcelPackage $pkg
|
||||
}
|
||||
|
||||
$pkg.Dispose()
|
||||
|
||||
@@ -35,7 +35,8 @@
|
||||
[string[]]$AsText,
|
||||
[string[]]$AsDate,
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$Password
|
||||
[String]$Password,
|
||||
[Int[]]$ImportColumns
|
||||
)
|
||||
end {
|
||||
$sw = [System.Diagnostics.Stopwatch]::StartNew()
|
||||
@@ -62,6 +63,16 @@
|
||||
)
|
||||
|
||||
try {
|
||||
if ($ImportColumns) {
|
||||
$end = $Worksheet.Dimension.End.Column
|
||||
# Check $ImportColumns
|
||||
if ($ImportColumns[0] -le 0) { throw "The first entry in ImportColumns must be equal or greater 1" ; return }
|
||||
# Check $StartColumn and $EndColumn
|
||||
if (($StartColumn -ne 1) -or ($EndColumn -ne $end)) { Write-Warning -Message "If ImportColumns is set, then individual StartColumn and EndColumn will be ignored." }
|
||||
# Replace $Columns with $ImportColumns
|
||||
$Columns = $ImportColumns
|
||||
}
|
||||
|
||||
if ($HeaderName) {
|
||||
$i = 0
|
||||
foreach ($H in $HeaderName) {
|
||||
|
||||
63
Public/Invoke-ExcelQuery.ps1
Normal file
63
Public/Invoke-ExcelQuery.ps1
Normal file
@@ -0,0 +1,63 @@
|
||||
#Requires -Version 5
|
||||
function Invoke-ExcelQuery {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Helper method for executing Read-OleDbData with some basic defaults.
|
||||
|
||||
For additional help, see documentation for Read-OleDbData cmdlet.
|
||||
|
||||
.DESCRIPTION
|
||||
Uses Read-OleDbData to execute a sql statement against a xlsx file. For finer grained control over the interaction, you may use that cmdlet. This cmdlet assumes a file path will be passed in and the connection string will be built with no headers and treating all results as text.
|
||||
|
||||
Running this command is equivalent to running the following:
|
||||
|
||||
$FullName = (Get-ChildItem $Path).FullName
|
||||
Read-OleDbData `
|
||||
-ConnectionString "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=$FullName;Extended Properties='Excel 12.0 Xml;HDR=NO;IMEX=1;'" `
|
||||
-SqlStatement $Query
|
||||
|
||||
Note that this command uses the MICROSOFT.ACE.OLEDB provider and will not work without it.
|
||||
|
||||
If needed, please download the appropriate package from https://www.microsoft.com/en-us/download/details.aspx?id=54920.
|
||||
|
||||
.EXAMPLE
|
||||
Invoke-ExcelQuery .\test.xlsx 'select ROUND(F1) as [A1] from [sheet3$A1:A1]'
|
||||
|
||||
.EXAMPLE
|
||||
$Path = (Get-ChildItem 'test.xlsx').FullName
|
||||
$Query = "select ROUND(F1) as [A] from [sheet1$A1:A1]"
|
||||
Read-XlsxUsingOleDb -Path $Path -Query $Query
|
||||
|
||||
.EXAMPLE
|
||||
$ReadDataArgs = @{
|
||||
Path = .\test.xlsx
|
||||
Query = Get-Content query.sql -Raw
|
||||
}
|
||||
$Results = Invoke-ExcelQuery @ReadDataArgs
|
||||
#>
|
||||
param(
|
||||
#The path to the file to open.
|
||||
[Parameter(Mandatory)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String] $Path, # var name consistent with Import-Excel
|
||||
[Parameter(Mandatory)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String] $Query # var name consistent with Invoke-Sqlcmd
|
||||
)
|
||||
|
||||
try {
|
||||
if ((New-Object system.data.oledb.oledbenumerator).GetElements().SOURCES_NAME -notcontains "Microsoft.ACE.OLEDB.12.0") {
|
||||
Write-Error "Microsoft.ACE.OLEDB.12.0 provider is missing! Please install from https://www.microsoft.com/en-us/download/details.aspx?id=54920"
|
||||
return
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Error "System.Data.OleDb is not working or you are on an unsupported platform."
|
||||
return
|
||||
}
|
||||
|
||||
$FullName = (Get-ChildItem $Path).FullName
|
||||
Read-OleDbData `
|
||||
-ConnectionString "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=$FullName;Extended Properties='Excel 12.0 Xml;HDR=NO;IMEX=1;'" `
|
||||
-SqlStatement $Query
|
||||
}
|
||||
@@ -35,7 +35,12 @@
|
||||
if ($pkgobj) {
|
||||
foreach ($w in $pkgobj.Workbook.Worksheets) {
|
||||
$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
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#Requires -Version 5
|
||||
function Read-Clipboard {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
@@ -22,9 +23,11 @@ function Read-Clipboard {
|
||||
$Header
|
||||
)
|
||||
|
||||
if ($IsWindows) {
|
||||
$osInfo = Get-CimInstance -ClassName Win32_OperatingSystem
|
||||
if ($osInfo.ProductType -eq 1) {
|
||||
if ($IsLinux -or $IsMacOS) {
|
||||
Write-Error "Read-Clipboard only runs on Windows"
|
||||
return
|
||||
}
|
||||
|
||||
$cvtParams = @{
|
||||
Data = Get-Clipboard -Raw
|
||||
}
|
||||
@@ -39,14 +42,6 @@ function Read-Clipboard {
|
||||
|
||||
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 {
|
||||
param(
|
||||
|
||||
54
Public/Read-OleDbData.ps1
Normal file
54
Public/Read-OleDbData.ps1
Normal file
@@ -0,0 +1,54 @@
|
||||
#Requires -Version 5
|
||||
function Read-OleDbData {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Read data from an OleDb source using dotnet classes. This allows for OleDb queries against excel spreadsheets. Examples will only be for querying xlsx files.
|
||||
|
||||
For additional documentation, see Microsoft's documentation on the System.Data OleDb namespace here:
|
||||
https://docs.microsoft.com/en-us/dotnet/api/system.data.oledb
|
||||
|
||||
.DESCRIPTION
|
||||
Read data from an OleDb source using dotnet classes. This allows for OleDb queries against excel spreadsheets. Examples will only be for querying xlsx files using ACE.
|
||||
|
||||
.EXAMPLE
|
||||
Read-OleDbData `
|
||||
-ConnectionString "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=file.xlsx;Extended Properties='Excel 12.0 Xml;HDR=NO;IMEX=1;'" `
|
||||
-SqlStatement "select ROUND(F1) as [A] from [sheet1$A1:A1]"
|
||||
|
||||
.EXAMPLE
|
||||
$ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=file.xlsx;Extended Properties='Excel 12.0 Xml;HDR=NO;IMEX=1;'"
|
||||
$SqlStatement = "select ROUND(F1) as [A] from [sheet1$A1:A1]"
|
||||
Read-OleDbData -ConnectionString $ConnectionString -SqlStatement $SqlStatement
|
||||
|
||||
.EXAMPLE
|
||||
$ReadDataArgs = @{
|
||||
SqlStatement = Get-Content query.sql -Raw
|
||||
ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=file.xlsx;Extended Properties='Excel 12.0 Xml;HDR=NO;IMEX=1;'"
|
||||
}
|
||||
$Results = Read-OleDbData @ReadDataArgs
|
||||
#>
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String] $ConnectionString,
|
||||
[Parameter(Mandatory)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String] $SqlStatement
|
||||
)
|
||||
|
||||
try {
|
||||
if ((New-Object system.data.oledb.oledbenumerator).GetElements().SOURCES_NAME -notcontains "Microsoft.ACE.OLEDB.12.0") {
|
||||
Write-Warning "Microsoft.ACE.OLEDB.12.0 provider is missing! You will not be able to query Excel files without it. Please install from https://www.microsoft.com/en-us/download/details.aspx?id=54920"
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Error "System.Data.OleDb is not working or you are on an unsupported platform."
|
||||
return
|
||||
}
|
||||
|
||||
$DataTable = new-object System.Data.DataTable
|
||||
$DataAdapter = new-object System.Data.OleDb.OleDbDataAdapter $SqlStatement, $ConnectionString
|
||||
$null = $DataAdapter.Fill($DataTable)
|
||||
$null = $DataAdapter.Dispose()
|
||||
$DataTable.Rows | Select-Object $DataTable.Columns.ColumnName
|
||||
}
|
||||
@@ -1,9 +1,18 @@
|
||||
#Requires -Modules Pester
|
||||
|
||||
if (-not (Get-command Import-Excel -ErrorAction SilentlyContinue)) {
|
||||
Import-Module $PSScriptRoot\..\ImportExcel.psd1
|
||||
}
|
||||
|
||||
Describe "Import-Excel on a sheet with no headings" {
|
||||
BeforeAll {
|
||||
|
||||
$xlfile = "TestDrive:\testImportExcel.xlsx"
|
||||
$xlfileHeaderOnly = "TestDrive:\testImportExcelHeaderOnly.xlsx"
|
||||
$xlfile = "$PSScriptRoot\testImportExcel.xlsx"
|
||||
$xlfileHeaderOnly = "$PSScriptRoot\testImportExcelHeaderOnly.xlsx"
|
||||
$xlfileImportColumns = "$PSScriptRoot\testImportExcelImportColumns.xlsx"
|
||||
|
||||
# Create $xlfile if it does not exist
|
||||
if (!(Test-Path -Path $xlfile)) {
|
||||
$xl = "" | Export-excel $xlfile -PassThru
|
||||
|
||||
Set-ExcelRange -Worksheet $xl.Sheet1 -Range A1 -Value 'A'
|
||||
@@ -19,8 +28,10 @@ Describe "Import-Excel on a sheet with no headings" {
|
||||
Set-ExcelRange -Worksheet $xl.Sheet1 -Range C3 -Value 'I'
|
||||
|
||||
Close-ExcelPackage $xl
|
||||
}
|
||||
|
||||
# crate $xlfileHeaderOnly
|
||||
# Create $xlfileHeaderOnly if it does not exist
|
||||
if (!(Test-Path -Path $xlfileHeaderOnly)) {
|
||||
$xl = "" | Export-excel $xlfileHeaderOnly -PassThru
|
||||
|
||||
Set-ExcelRange -Worksheet $xl.Sheet1 -Range A1 -Value 'A'
|
||||
@@ -30,6 +41,28 @@ Describe "Import-Excel on a sheet with no headings" {
|
||||
Close-ExcelPackage $xl
|
||||
}
|
||||
|
||||
# Create $xlfileImportColumns if it does not exist
|
||||
if (!(Test-Path -Path $xlfileImportColumns)) {
|
||||
$xl = "" | Export-Excel $xlfileImportColumns -PassThru
|
||||
|
||||
Set-ExcelRange -Worksheet $xl.Sheet1 -Range A1 -Value 'A'
|
||||
Set-ExcelRange -Worksheet $xl.Sheet1 -Range B1 -Value 'B'
|
||||
Set-ExcelRange -Worksheet $xl.Sheet1 -Range C1 -Value 'C'
|
||||
Set-ExcelRange -Worksheet $xl.Sheet1 -Range D1 -Value 'D'
|
||||
Set-ExcelRange -Worksheet $xl.Sheet1 -Range E1 -Value 'E'
|
||||
Set-ExcelRange -Worksheet $xl.Sheet1 -Range F1 -Value 'F'
|
||||
|
||||
Set-ExcelRange -Worksheet $xl.Sheet1 -Range A2 -Value '1'
|
||||
Set-ExcelRange -Worksheet $xl.Sheet1 -Range B2 -Value '2'
|
||||
Set-ExcelRange -Worksheet $xl.Sheet1 -Range C2 -Value '3'
|
||||
Set-ExcelRange -Worksheet $xl.Sheet1 -Range D2 -Value '4'
|
||||
Set-ExcelRange -Worksheet $xl.Sheet1 -Range E2 -Value '5'
|
||||
Set-ExcelRange -Worksheet $xl.Sheet1 -Range F2 -Value '6'
|
||||
|
||||
Close-ExcelPackage $xl
|
||||
}
|
||||
}
|
||||
|
||||
It "Import-Excel should have this shape" {
|
||||
$actual = @(Import-Excel $xlfile)
|
||||
|
||||
@@ -167,7 +200,7 @@ Describe "Import-Excel on a sheet with no headings" {
|
||||
}
|
||||
|
||||
It "Should" {
|
||||
$xlfile = "TestDrive:\testImportExcelSparse.xlsx"
|
||||
$xlfile = "$PSScriptRoot\testImportExcelSparse.xlsx"
|
||||
$xl = "" | Export-excel $xlfile -PassThru
|
||||
|
||||
Set-ExcelRange -Worksheet $xl.Sheet1 -Range A1 -Value 'Chuck'
|
||||
@@ -224,4 +257,139 @@ Describe "Import-Excel on a sheet with no headings" {
|
||||
$actual[0].P2 | Should -Be 'B'
|
||||
$actual[0].P3 | Should -Be 'C'
|
||||
}
|
||||
|
||||
It "Should import correct data if -ImportColumns is used with the first column" {
|
||||
$actual = @(Import-Excel $xlfileImportColumns -ImportColumns @(1,2,4,5))
|
||||
$actualNames = $actual[0].psobject.properties.Name
|
||||
|
||||
$actualNames.Count | Should -Be 4
|
||||
$actualNames[0] | Should -Be 'A'
|
||||
$actualNames[2] | Should -Be 'D'
|
||||
|
||||
$actual.Count | Should -Be 1
|
||||
$actual[0].A | Should -Be 1
|
||||
$actual[0].B | Should -Be 2
|
||||
$actual[0].D | Should -Be 4
|
||||
$actual[0].E | Should -Be 5
|
||||
}
|
||||
|
||||
It "Should import correct data if -ImportColumns is used with the first column" {
|
||||
$actual = @(Import-Excel $xlfileImportColumns -ImportColumns @(1,3,4,5))
|
||||
$actualNames = $actual[0].psobject.properties.Name
|
||||
|
||||
$actualNames.Count | Should -Be 4
|
||||
$actualNames[0] | Should -Be 'A'
|
||||
$actualNames[2] | Should -Be 'D'
|
||||
|
||||
$actual.Count | Should -Be 1
|
||||
$actual[0].A | Should -Be 1
|
||||
$actual[0].C | Should -Be 3
|
||||
$actual[0].D | Should -Be 4
|
||||
$actual[0].E | Should -Be 5
|
||||
}
|
||||
|
||||
It "Should import correct data if -ImportColumns is used without the first column" {
|
||||
$actual = @(Import-Excel $xlfileImportColumns -ImportColumns @(2,3,6))
|
||||
$actualNames = $actual[0].psobject.properties.Name
|
||||
|
||||
$actualNames.Count | Should -Be 3
|
||||
$actualNames[0] | Should -Be 'B'
|
||||
$actualNames[2] | Should -Be 'F'
|
||||
|
||||
$actual.Count | Should -Be 1
|
||||
$actual[0].B | Should -Be 2
|
||||
$actual[0].C | Should -Be 3
|
||||
$actual[0].F | Should -Be 6
|
||||
}
|
||||
|
||||
It "Should import correct data if -ImportColumns is used without the first column" {
|
||||
$actual = @(Import-Excel $xlfileImportColumns -ImportColumns @(2,5,6))
|
||||
$actualNames = $actual[0].psobject.properties.Name
|
||||
|
||||
$actualNames.Count | Should -Be 3
|
||||
$actualNames[0] | Should -Be 'B'
|
||||
$actualNames[2] | Should -Be 'F'
|
||||
|
||||
$actual.Count | Should -Be 1
|
||||
$actual[0].B | Should -Be 2
|
||||
$actual[0].E | Should -Be 5
|
||||
$actual[0].F | Should -Be 6
|
||||
}
|
||||
|
||||
It "Should import correct data if -ImportColumns is used with only 1 column" {
|
||||
$actual = @(Import-Excel $xlfile -ImportColumns @(2))
|
||||
$actualNames = $actual[0].psobject.properties.Name
|
||||
|
||||
$actualNames.Count | Should -Be 1
|
||||
$actualNames[0] | Should -Be 'B'
|
||||
|
||||
$actual.Count | Should -Be 2
|
||||
$actual[0].B | Should -Be 'E'
|
||||
}
|
||||
|
||||
It "Should import correct data if -ImportColumns is used with only 1 column which is also the last" {
|
||||
$actual = @(Import-Excel $xlfile -ImportColumns @(3))
|
||||
$actualNames = $actual[0].psobject.properties.Name
|
||||
|
||||
$actualNames.Count | Should -Be 1
|
||||
$actualNames[0] | Should -Be 'C'
|
||||
|
||||
$actual.Count | Should -Be 2
|
||||
$actual[1].C | Should -Be 'I'
|
||||
}
|
||||
|
||||
It "Should import correct data if -ImportColumns contains all columns" {
|
||||
$actual = @(Import-Excel $xlfileImportColumns -ImportColumns @(1,2,3,4,5,6))
|
||||
$actualNames = $actual[0].psobject.properties.Name
|
||||
|
||||
$actualNames.Count | Should -Be 6
|
||||
$actualNames[0] | Should -Be 'A'
|
||||
$actualNames[2] | Should -Be 'C'
|
||||
|
||||
$actual.Count | Should -Be 1
|
||||
$actual[0].A | Should -Be 1
|
||||
$actual[0].B | Should -Be 2
|
||||
$actual[0].C | Should -Be 3
|
||||
$actual[0].D | Should -Be 4
|
||||
$actual[0].E | Should -Be 5
|
||||
$actual[0].F | Should -Be 6
|
||||
}
|
||||
|
||||
It "Should ignore -StartColumn and -EndColumn if -ImportColumns is set aswell" {
|
||||
$actual = @(Import-Excel $xlfileImportColumns -ImportColumns @(5) -StartColumn 2 -EndColumn 7)
|
||||
$actualNames = $actual[0].psobject.properties.Name
|
||||
|
||||
$actualNames.Count | Should -Be 1
|
||||
$actualNames[0] | Should -Be 'E'
|
||||
|
||||
$actual[0].E | Should -Be '5'
|
||||
}
|
||||
|
||||
It "Should arrange the columns if -ImportColumns is not in order" {
|
||||
$actual = @(Import-Excel $xlfileImportColumns -ImportColumns @(5,1,4))
|
||||
$actualNames = $actual[0].psobject.properties.Name
|
||||
|
||||
$actualNames.Count | Should -Be 3
|
||||
$actualNames[0] | Should -Be 'E'
|
||||
$actualNames[1] | Should -Be 'A'
|
||||
$actualNames[2] | Should -Be 'D'
|
||||
|
||||
$actual[0].E | Should -Be '5'
|
||||
$actual[0].A | Should -Be '1'
|
||||
$actual[0].D | Should -Be '4'
|
||||
}
|
||||
|
||||
It "Should arrange the columns if -ImportColumns is not in order and -NoHeader is used" {
|
||||
$actual = @(Import-Excel $xlfileImportColumns -ImportColumns @(5,1,4) -NoHeader -StartRow 2)
|
||||
$actualNames = $actual[0].psobject.properties.Name
|
||||
|
||||
$actualNames.Count | Should -Be 3
|
||||
$actualNames[0] | Should -Be 'P1'
|
||||
$actualNames[1] | Should -Be 'P2'
|
||||
$actualNames[2] | Should -Be 'P3'
|
||||
|
||||
$actual[0].P1 | Should -Be '5'
|
||||
$actual[0].P2 | Should -Be '1'
|
||||
$actual[0].P3 | Should -Be '4'
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
46
__tests__/Read-OleDbDataTests/Invoke-ExcelQuery.Tests.ps1
Normal file
46
__tests__/Read-OleDbDataTests/Invoke-ExcelQuery.Tests.ps1
Normal file
@@ -0,0 +1,46 @@
|
||||
#Requires -Modules Pester
|
||||
if (-not (Get-command Import-Excel -ErrorAction SilentlyContinue)) {
|
||||
Import-Module $PSScriptRoot\..\ImportExcel.psd1
|
||||
}
|
||||
|
||||
$skip = $false
|
||||
if ($IsLinux -or $IsMacOS) {
|
||||
$skip = $true
|
||||
Write-Warning "Invoke-ExcelQuery: Linux and MacOs are not supported. Skipping tests."
|
||||
}else{
|
||||
try {
|
||||
if ((New-Object system.data.oledb.oledbenumerator).GetElements().SOURCES_NAME -notcontains "Microsoft.ACE.OLEDB.12.0") {
|
||||
$skip = $true
|
||||
Write-Warning "Invoke-ExcelQuery: Microsoft.ACE.OLEDB.12.0 provider not found. Skipping tests."
|
||||
}
|
||||
}
|
||||
catch {
|
||||
$skip = $true
|
||||
Write-Warning "Invoke-ExcelQuery: Calls to System.Data.OleDb failed. Skipping tests."
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Describe "Invoke-ExcelQuery" -Tag "Invoke-ExcelQuery" {
|
||||
$PSDefaultParameterValues = @{ 'It:Skip' = $skip }
|
||||
BeforeAll {
|
||||
$tfp = "$PSScriptRoot\Read-OleDbData.xlsx"
|
||||
}
|
||||
Context "Basic Checks" {
|
||||
It "Should have a valid Test file" {
|
||||
Test-Path $tfp | Should -Be $true
|
||||
}
|
||||
It "Should have the Read-OleDbData command loaded" {
|
||||
(Get-Command Read-OleDbData -ErrorAction SilentlyContinue) -ne $null | Should -Be $true
|
||||
}
|
||||
It "Should have the Invoke-ExcelQuery command loaded" {
|
||||
(Get-Command Invoke-ExcelQuery -ErrorAction SilentlyContinue) -ne $null | Should -Be $true
|
||||
}
|
||||
}
|
||||
Context "Sheet1`$A1" {
|
||||
It "Should return 1 result with a value of 1" {
|
||||
$Results = Invoke-ExcelQuery $tfp "select ROUND(F1) as [A1] from [sheet1`$A1:A1]"
|
||||
@($Results).length + $Results.A1 | Should -Be 2
|
||||
}
|
||||
}
|
||||
}
|
||||
4
__tests__/Read-OleDbDataTests/Read-OleDbData.TestA.sql
Normal file
4
__tests__/Read-OleDbDataTests/Read-OleDbData.TestA.sql
Normal file
@@ -0,0 +1,4 @@
|
||||
select
|
||||
ROUND(F1) as [A1]
|
||||
from
|
||||
[sheet3$A1:A1]
|
||||
7
__tests__/Read-OleDbDataTests/Read-OleDbData.TestB.sql
Normal file
7
__tests__/Read-OleDbDataTests/Read-OleDbData.TestB.sql
Normal file
@@ -0,0 +1,7 @@
|
||||
select ROUND(F1) as [A1] from [sheet1$A1:A1]
|
||||
union all select ROUND(F1) as [A1] from [sheet2$A1:A1]
|
||||
union all select ROUND(F1) as [A1] from [sheet3$A1:A1]
|
||||
union all select ROUND(F1) as [A1] from [sheet4$A1:A1]
|
||||
union all select ROUND(F1) as [A1] from [sheet5$A1:A1]
|
||||
union all select ROUND(F1) as [A1] from [sheet6$A1:A1]
|
||||
union all select ROUND(F1) as [A1] from [sheet7$A1:A1]
|
||||
4
__tests__/Read-OleDbDataTests/Read-OleDbData.TestC.sql
Normal file
4
__tests__/Read-OleDbDataTests/Read-OleDbData.TestC.sql
Normal file
@@ -0,0 +1,4 @@
|
||||
select
|
||||
*
|
||||
from
|
||||
[sheet1$A1:E10]
|
||||
10
__tests__/Read-OleDbDataTests/Read-OleDbData.TestD.sql
Normal file
10
__tests__/Read-OleDbDataTests/Read-OleDbData.TestD.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
select top 1
|
||||
'All A1s' as [A1],
|
||||
F1 as [Sheet1],
|
||||
(select F1 FROM [sheet2$a1:a1]) as [Sheet2],
|
||||
(select F1 FROM [sheet3$a1:a1]) as [Sheet3],
|
||||
(select F1 FROM [sheet4$a1:a1]) as [Sheet4],
|
||||
(select F1 FROM [sheet5$a1:a1]) as [Sheet5],
|
||||
(select F1 FROM [sheet6$a1:a1]) as [Sheet6],
|
||||
(select F1 FROM [sheet7$a1:a1]) as [Sheet7]
|
||||
FROM [sheet1$a1:a1]
|
||||
31
__tests__/Read-OleDbDataTests/Read-OleDbData.TestE.sql
Normal file
31
__tests__/Read-OleDbDataTests/Read-OleDbData.TestE.sql
Normal file
@@ -0,0 +1,31 @@
|
||||
select top 1
|
||||
'All A1s Start from Sheet1' as [A1],
|
||||
F1 as [Sheet1],
|
||||
(select F1 FROM [sheet2$a1:a1]) as [Sheet2],
|
||||
(select F1 FROM [sheet3$a1:a1]) as [Sheet3],
|
||||
(select F1 FROM [sheet4$a1:a1]) as [Sheet4]
|
||||
FROM [sheet1$a1:a1]
|
||||
UNION ALL
|
||||
select top 1
|
||||
'All A1s Start from Sheet2' as [A1],
|
||||
(select F1 FROM [sheet1$a1:a1]) as [Sheet1],
|
||||
F1 as [Sheet2],
|
||||
(select F1 FROM [sheet3$a1:a1]) as [Sheet3],
|
||||
(select F1 FROM [sheet4$a1:a1]) as [Sheet4]
|
||||
FROM [sheet2$a1:a1]
|
||||
UNION ALL
|
||||
select top 1
|
||||
'All A1s Start from Sheet3' as [A1],
|
||||
(select F1 FROM [sheet1$a1:a1]) as [Sheet1],
|
||||
(select F1 FROM [sheet2$a1:a1]) as [Sheet2],
|
||||
F1 as [Sheet3],
|
||||
(select F1 FROM [sheet4$a1:a1]) as [Sheet4]
|
||||
FROM [sheet3$a1:a1]
|
||||
UNION ALL
|
||||
select top 1
|
||||
'All A1s Start from Sheet4' as [A1],
|
||||
(select F1 FROM [sheet1$a1:a1]) as [Sheet1],
|
||||
(select F1 FROM [sheet2$a1:a1]) as [Sheet2],
|
||||
(select F1 FROM [sheet3$a1:a1]) as [Sheet3],
|
||||
F1 as [Sheet4]
|
||||
FROM [sheet4$a1:a1]
|
||||
92
__tests__/Read-OleDbDataTests/Read-OleDbData.Tests.ps1
Normal file
92
__tests__/Read-OleDbDataTests/Read-OleDbData.Tests.ps1
Normal file
@@ -0,0 +1,92 @@
|
||||
#Requires -Modules Pester
|
||||
if (-not (Get-command Import-Excel -ErrorAction SilentlyContinue)) {
|
||||
Import-Module $PSScriptRoot\..\ImportExcel.psd1
|
||||
}
|
||||
|
||||
$skip = $false
|
||||
if ($IsLinux -or $IsMacOS) {
|
||||
$skip = $true
|
||||
Write-Warning "Read-OleDbData: Linux and MacOs are not supported. Skipping tests."
|
||||
}else{
|
||||
try {
|
||||
if ((New-Object system.data.oledb.oledbenumerator).GetElements().SOURCES_NAME -notcontains "Microsoft.ACE.OLEDB.12.0") {
|
||||
$skip = $true
|
||||
Write-Warning "Read-OleDbData: Microsoft.ACE.OLEDB.12.0 provider not found. Skipping tests."
|
||||
}
|
||||
}
|
||||
catch {
|
||||
$skip = $true
|
||||
Write-Warning "Read-OleDbData: Calls to System.Data.OleDb failed. Skipping tests."
|
||||
}
|
||||
}
|
||||
Describe "Read-OleDbData" -Tag "Read-OleDbData" {
|
||||
$PSDefaultParameterValues = @{ 'It:Skip' = $skip }
|
||||
BeforeAll {
|
||||
$scriptPath = $PSScriptRoot
|
||||
$tfp = "$scriptPath\Read-OleDbData.xlsx"
|
||||
$cs = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=$tfp;Extended Properties='Excel 12.0 Xml;HDR=NO;IMEX=1;'"
|
||||
}
|
||||
Context "Basic Tests" {
|
||||
It "Should have a valid Test file" {
|
||||
Test-Path $tfp | Should -Be $true
|
||||
}
|
||||
It "Should have the Read-OleDbData command loaded" {
|
||||
(Get-Command Read-OleDbData -ErrorAction SilentlyContinue) -ne $null | Should -Be $true
|
||||
}
|
||||
It "Should be able to open spreadsheet" {
|
||||
$null = Read-OleDbData -ConnectionString $cs -SqlStatement "select 1"
|
||||
$true | Should -Be $true
|
||||
}
|
||||
It "Should return PSCustomObject for single result" {
|
||||
#multiple records will come back as Object[], but not going to test for that
|
||||
$Results = Read-OleDbData -ConnectionString $cs -SqlStatement "select 1"
|
||||
$Results.GetType().Name | Should -Be 'PSCustomObject'
|
||||
}
|
||||
}
|
||||
Context "Sheet1`$A1" {
|
||||
It "Should return 1 result with a value of 1" {
|
||||
$sql = "select ROUND(F1) as [A1] from [sheet1`$A1:A1]"
|
||||
$Results = Read-OleDbData -ConnectionString $cs -SqlStatement $sql
|
||||
@($Results).length + $Results.A1 | Should -Be 2
|
||||
}
|
||||
}
|
||||
Context "Sheet2`$A1" {
|
||||
It "Should return 1 result with value of 2" {
|
||||
$sql = "select ROUND(F1) as [A1] from [sheet2`$A1:A1]"
|
||||
$Results = Read-OleDbData -ConnectionString $cs -SqlStatement $sql
|
||||
@($Results).length + $Results.A1 | Should -Be 3
|
||||
}
|
||||
}
|
||||
Context "Sheet3`$A1, Sql from file" {
|
||||
It "Should return 1 result with value of 3" {
|
||||
$Results = Read-OleDbData -ConnectionString $cs -SqlStatement (Get-Content "$scriptPath\Read-OleDbData.TestA.sql" -raw)
|
||||
@($Results).length + $Results.A1 | Should -Be 4
|
||||
}
|
||||
}
|
||||
Context "Sheets[1-7]`$A1, Sql from file" {
|
||||
It "Should return 7 result with where sum values 1-6 = value 7" {
|
||||
$Results = Read-OleDbData -ConnectionString $cs -SqlStatement (Get-Content "$scriptPath\Read-OleDbData.TestB.sql" -raw)
|
||||
$a = $Results.A1
|
||||
$a.length + ($a[0..5] | Measure-Object -sum).sum | Should -Be (7 + $a[6])
|
||||
}
|
||||
}
|
||||
Context "Sheet1`$:A1:E10, Sql from file" {
|
||||
#note, this spreadsheet doesn't have the fields populated other than A1, so it will, correctly, return only one value
|
||||
It "Should return 1 result with value of 1" {
|
||||
$Results = Read-OleDbData -ConnectionString $cs -SqlStatement (Get-Content "$scriptPath\Read-OleDbData.TestC.sql" -raw)
|
||||
@($Results).length + $Results.F1 | Should -Be 2
|
||||
}
|
||||
}
|
||||
Context "When Read-OleDbData.xlsx, select a1 from all sheets as a single record, and sql is in a file" {
|
||||
It "should return one row with 8 columns" {
|
||||
$Results = Read-OleDbData -ConnectionString $cs -SqlStatement (Get-Content "$scriptPath\Read-OleDbData.TestD.sql" -raw)
|
||||
@($Results).length + @($Results.psobject.Properties).length | Should -Be 9
|
||||
}
|
||||
}
|
||||
Context "When Read-OleDbData.xlsx, select a1 from all sheets as a single record multiple times to create a range, and sql is in a file" {
|
||||
It "should return 4 records with 5 columns" {
|
||||
$Results = Read-OleDbData -ConnectionString $cs -SqlStatement (Get-Content "$scriptPath\Read-OleDbData.TestE.sql" -raw)
|
||||
@($Results).length + @($Results[0].psobject.Properties).length | Should -Be 9
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
__tests__/Read-OleDbDataTests/Read-OleDbData.xlsx
Normal file
BIN
__tests__/Read-OleDbDataTests/Read-OleDbData.xlsx
Normal file
Binary file not shown.
BIN
__tests__/UnsupportedWorkSheetNames.xlsx
Normal file
BIN
__tests__/UnsupportedWorkSheetNames.xlsx
Normal file
Binary file not shown.
BIN
__tests__/testImportExcel.xlsx
Normal file
BIN
__tests__/testImportExcel.xlsx
Normal file
Binary file not shown.
BIN
__tests__/testImportExcelHeaderOnly.xlsx
Normal file
BIN
__tests__/testImportExcelHeaderOnly.xlsx
Normal file
Binary file not shown.
BIN
__tests__/testImportExcelImportColumns.xlsx
Normal file
BIN
__tests__/testImportExcelImportColumns.xlsx
Normal file
Binary file not shown.
BIN
__tests__/testImportExcelSparse.xlsx
Normal file
BIN
__tests__/testImportExcelSparse.xlsx
Normal file
Binary file not shown.
@@ -20,6 +20,25 @@ jobs:
|
||||
vmImage: 'windows-latest'
|
||||
|
||||
steps:
|
||||
|
||||
# BEGIN - ACE support for Invoke-ExcelQuery testing
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: v2 | "$(Agent.OS)" | ace
|
||||
path: ace
|
||||
cacheHitVar: CACHE_RESTORED
|
||||
displayName: Cache ACE
|
||||
|
||||
- bash: |
|
||||
mkdir ./ace
|
||||
curl -o ./ace/ace.exe https://download.microsoft.com/download/3/5/C/35C84C36-661A-44E6-9324-8786B8DBE231/accessdatabaseengine_X64.exe
|
||||
displayName: 'Download ACE'
|
||||
condition: ne(variables.CACHE_RESTORED, 'true')
|
||||
|
||||
- powershell: Start-Process ./ace/ace.exe -Wait -ArgumentList "/quiet /passive /norestart"
|
||||
displayName: 'Install ACE for Invoke-ExcelQuery testing'
|
||||
# END - ACE support for Invoke-ExcelQuery testing
|
||||
|
||||
- powershell: 'Install-Module -Name Pester -Force -SkipPublisherCheck'
|
||||
displayName: 'Update Pester'
|
||||
- powershell: './CI/CI.ps1 -Test'
|
||||
@@ -49,6 +68,25 @@ jobs:
|
||||
vmImage: 'windows-latest'
|
||||
|
||||
steps:
|
||||
|
||||
# BEGIN - ACE support for Invoke-ExcelQuery testing
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: v2 | "$(Agent.OS)" | ace
|
||||
path: ace
|
||||
cacheHitVar: CACHE_RESTORED
|
||||
displayName: Cache ACE
|
||||
|
||||
- bash: |
|
||||
mkdir ./ace
|
||||
curl -o ./ace/ace.exe https://download.microsoft.com/download/3/5/C/35C84C36-661A-44E6-9324-8786B8DBE231/accessdatabaseengine_X64.exe
|
||||
displayName: 'Download ACE'
|
||||
condition: ne(variables.CACHE_RESTORED, 'true')
|
||||
|
||||
- powershell: Start-Process ./ace/ace.exe -Wait -ArgumentList "/quiet /passive /norestart"
|
||||
displayName: 'Install ACE for Invoke-ExcelQuery testing'
|
||||
# END - ACE support for Invoke-ExcelQuery testing
|
||||
|
||||
- pwsh: 'Install-Module -Name Pester -Force'
|
||||
displayName: 'Update Pester'
|
||||
- pwsh: './CI/CI.ps1 -Test'
|
||||
|
||||
66
changelog.md
66
changelog.md
@@ -1,7 +1,73 @@
|
||||
# v7.4.1
|
||||
|
||||
- Implements: https://github.com/dfinke/ImportExcel/issues/1111
|
||||
- Refactored ReZip into separate function
|
||||
- Deletes temp folder after rezipping
|
||||
- Added -ReZip to `Close-ExcelPackage`
|
||||
|
||||
# v7.4.0
|
||||
|
||||
- Thank you to [Max Goczall](https://github.com/muschebubusche) for this contribution!
|
||||
- `ImportColumns` parameter added to `ImportExcel`. It is used to define which columns of the ExcelPackage should be imported.
|
||||
|
||||
```powershell
|
||||
Import-Excel -Path $xlFile -ImportColumns @(6,7,12,25,46)
|
||||
```
|
||||
|
||||
# v7.3.1
|
||||
|
||||
- Added query Excel spreadsheets, with SQL queries!
|
||||
|
||||
```powershell
|
||||
$query = 'select F2 as [Category], F5 as [Discount], F5*2 as [DiscountPlus] from [sheet1$A2:E11]'
|
||||
|
||||
Invoke-ExcelQuery .\testOleDb.xlsx $query
|
||||
```
|
||||
|
||||

|
||||
|
||||
## Result
|
||||
|
||||
```
|
||||
Category Discount DiscountPlus
|
||||
-------- -------- ------------
|
||||
Cosmetics 0.7 1.4
|
||||
Grocery 0.3 0.6
|
||||
Apparels 0.2 0.4
|
||||
Electronics 0.1 0.2
|
||||
Electronics 0 0
|
||||
Apparels 0.8 1.6
|
||||
Electronics 0.7 1.4
|
||||
Cosmetics 0.6 1.2
|
||||
Grocery 0.4 0.8
|
||||
Grocery 0.3 0.6
|
||||
```
|
||||
|
||||
- Thank you to Roy Ashbrook for the SQL query code. Catch up with Roy:
|
||||
|
||||
|Media|Link|
|
||||
|---|---|
|
||||
|twitter|https://twitter.com/royashbrook
|
||||
|github|https://github.com/royashbrook
|
||||
|linkedin|https://linkedin.com/in/royashbrook
|
||||
|blog|https://ashbrook.io
|
||||
|
||||
# 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
|
||||
|
||||
- Improve auto-detection of data on the clipboard
|
||||
|
||||
# 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.
|
||||
|
||||
BIN
images/FAQ_Images/DataStructureExcelPkg.png
Normal file
BIN
images/FAQ_Images/DataStructureExcelPkg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
BIN
images/FAQ_Images/ExcelFileContents.png
Normal file
BIN
images/FAQ_Images/ExcelFileContents.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.3 KiB |
BIN
images/FAQ_Images/ExcelFileContentsPostAdd.png
Normal file
BIN
images/FAQ_Images/ExcelFileContentsPostAdd.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.1 KiB |
BIN
images/FAQ_Images/ExcelFileDebugImg.jpg
Normal file
BIN
images/FAQ_Images/ExcelFileDebugImg.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
BIN
images/FAQ_Images/ValueAtIndexData.png
Normal file
BIN
images/FAQ_Images/ValueAtIndexData.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
BIN
images/SQL-Spreadsheet.png
Normal file
BIN
images/SQL-Spreadsheet.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
@@ -9,7 +9,7 @@ schema: 2.0.0
|
||||
|
||||
## SYNOPSIS
|
||||
|
||||
Returns an ExcelPackage object for the specified XLSX fil.e
|
||||
Returns an ExcelPackage object for the specified XLSX file.
|
||||
|
||||
## SYNTAX
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# Public
|
||||
|
||||
@@ -1,157 +0,0 @@
|
||||
---
|
||||
external help file: ImportExcel-help.xml
|
||||
Module Name: ImportExcel
|
||||
online version: null
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# ConvertFrom-ExcelData
|
||||
|
||||
## SYNOPSIS
|
||||
|
||||
Reads data from a sheet, and for each row, calls a custom scriptblock with a list of property names and the row of data.
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```text
|
||||
ConvertFrom-ExcelData [-Path] <Object> [[-ScriptBlock] <ScriptBlock>] [[-WorksheetName] <Object>]
|
||||
[[-HeaderRow] <Int32>] [[-Header] <String[]>] [-NoHeader] [-DataOnly] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### EXAMPLE 1
|
||||
|
||||
```text
|
||||
ConvertFrom-ExcelData .\testSQLGen.xlsx {
|
||||
```
|
||||
|
||||
param\($propertyNames, $record\)
|
||||
|
||||
```text
|
||||
$reportRecord = @()
|
||||
foreach ($pn in $propertyNames) {
|
||||
$reportRecord += "{0}: {1}" -f $pn, $record.$pn
|
||||
}
|
||||
$reportRecord +=""
|
||||
$reportRecord -join "\`r\`n"
|
||||
```
|
||||
|
||||
}
|
||||
|
||||
First: John Last: Doe The Zip: 12345 ....
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -Path
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases: FullName
|
||||
|
||||
Required: True
|
||||
Position: 1
|
||||
Default value: None
|
||||
Accept pipeline input: True (ByPropertyName, ByValue)
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -ScriptBlock
|
||||
|
||||
```yaml
|
||||
Type: ScriptBlock
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 2
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -WorksheetName
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases: Sheet
|
||||
|
||||
Required: False
|
||||
Position: 3
|
||||
Default value: 1
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -HeaderRow
|
||||
|
||||
```yaml
|
||||
Type: Int32
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 4
|
||||
Default value: 1
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Header
|
||||
|
||||
```yaml
|
||||
Type: String[]
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 5
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -NoHeader
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: False
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -DataOnly
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: False
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about\_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
---
|
||||
external help file: ImportExcel-help.xml
|
||||
Module Name: ImportExcel
|
||||
online version: null
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# ConvertTo-ExcelXlsx
|
||||
|
||||
## SYNOPSIS
|
||||
|
||||
Converts an Excel xls to a xlsx using -ComObject
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```text
|
||||
ConvertTo-ExcelXlsx [-Path] <String> [-Force] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
|
||||
```text
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -Path
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 1
|
||||
Default value: None
|
||||
Accept pipeline input: True (ByValue)
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Force
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: False
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about\_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
---
|
||||
external help file: ImportExcel-help.xml
|
||||
Module Name: ImportExcel
|
||||
online version: 'https://github.com/dfinke/ImportExcel'
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Get-ExcelColumnName
|
||||
|
||||
## SYNOPSIS
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```text
|
||||
Get-ExcelColumnName [[-ColumnNumber] <Object>] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
|
||||
```text
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -ColumnNumber
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: True (ByValue)
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about\_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### System.Object
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
---
|
||||
external help file: ImportExcel-help.xml
|
||||
Module Name: ImportExcel
|
||||
online version: 'https://github.com/dfinke/ImportExcel'
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Get-HtmlTable
|
||||
|
||||
## SYNOPSIS
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```text
|
||||
Get-HtmlTable [-Url] <Object> [[-TableIndex] <Object>] [[-Header] <Object>] [[-FirstDataRow] <Int32>]
|
||||
[-UseDefaultCredentials] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
|
||||
```text
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -FirstDataRow
|
||||
|
||||
```yaml
|
||||
Type: Int32
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 3
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Header
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 2
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -UseDefaultCredentials
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -TableIndex
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 1
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Url
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about\_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
---
|
||||
external help file: ImportExcel-help.xml
|
||||
Module Name: ImportExcel
|
||||
online version: 'https://github.com/dfinke/ImportExcel'
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Get-Range
|
||||
|
||||
## SYNOPSIS
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```text
|
||||
Get-Range [[-Start] <Object>] [[-Stop] <Object>] [[-Step] <Object>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
|
||||
```text
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -start
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Step
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 2
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -stop
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 1
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
---
|
||||
external help file: ImportExcel-help.xml
|
||||
Module Name: ImportExcel
|
||||
online version: 'https://github.com/dfinke/ImportExcel'
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Get-XYRange
|
||||
|
||||
## SYNOPSIS
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```text
|
||||
Get-XYRange [[-TargetData] <Object>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
|
||||
```text
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -TargetData
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
---
|
||||
external help file: ImportExcel-help.xml
|
||||
Module Name: ImportExcel
|
||||
online version: 'https://github.com/dfinke/ImportExcel'
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Import-Html
|
||||
|
||||
## SYNOPSIS
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```text
|
||||
Import-Html [[-Url] <Object>] [[-Index] <Object>] [[-Header] <Object>] [[-FirstDataRow] <Int32>]
|
||||
[-UseDefaultCredentials] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
|
||||
```text
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -FirstDataRow
|
||||
|
||||
```yaml
|
||||
Type: Int32
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 3
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Header
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 2
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -UseDefaultCredentials
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Index
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 1
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Url
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about\_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
---
|
||||
external help file: ImportExcel-help.xml
|
||||
Module Name: ImportExcel
|
||||
online version: 'https://github.com/dfinke/ImportExcel'
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Import-UPS
|
||||
|
||||
## SYNOPSIS
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```text
|
||||
Import-UPS [[-TrackingNumber] <Object>] [-UseDefaultCredentials]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
|
||||
```text
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -TrackingNumber
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -UseDefaultCredentials
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
---
|
||||
external help file: ImportExcel-help.xml
|
||||
Module Name: ImportExcel
|
||||
online version: 'https://github.com/dfinke/ImportExcel'
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Import-USPS
|
||||
|
||||
## SYNOPSIS
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```text
|
||||
Import-USPS [[-TrackingNumber] <Object>] [-UseDefaultCredentials]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
|
||||
```text
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -TrackingNumber
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -UseDefaultCredentials
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
---
|
||||
external help file: ImportExcel-help.xml
|
||||
Module Name: ImportExcel
|
||||
online version: 'https://github.com/dfinke/ImportExcel'
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Invoke-Sum
|
||||
|
||||
## SYNOPSIS
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```text
|
||||
Invoke-Sum [[-Data] <Object>] [[-Dimension] <Object>] [[-Measure] <Object>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
|
||||
```text
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -Data
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Dimension
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 1
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Measure
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 2
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
||||
|
||||
@@ -1,535 +0,0 @@
|
||||
---
|
||||
external help file: ImportExcel-help.xml
|
||||
Module Name: ImportExcel
|
||||
online version: null
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# New-ExcelStyle
|
||||
|
||||
## SYNOPSIS
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```text
|
||||
New-ExcelStyle [[-Range] <Object>] [[-NumberFormat] <Object>] [[-BorderAround] <ExcelBorderStyle>]
|
||||
[[-BorderColor] <Object>] [[-BorderBottom] <ExcelBorderStyle>] [[-BorderTop] <ExcelBorderStyle>]
|
||||
[[-BorderLeft] <ExcelBorderStyle>] [[-BorderRight] <ExcelBorderStyle>] [[-FontColor] <Object>]
|
||||
[[-Value] <Object>] [[-Formula] <Object>] [-ArrayFormula] [-ResetFont] [-Bold] [-Italic] [-Underline]
|
||||
[[-UnderLineType] <ExcelUnderLineType>] [-StrikeThru] [[-FontShift] <ExcelVerticalAlignmentFont>]
|
||||
[[-FontName] <String>] [[-FontSize] <Single>] [[-BackgroundColor] <Object>]
|
||||
[[-BackgroundPattern] <ExcelFillStyle>] [[-PatternColor] <Object>] [-WrapText]
|
||||
[[-HorizontalAlignment] <ExcelHorizontalAlignment>] [[-VerticalAlignment] <ExcelVerticalAlignment>]
|
||||
[[-TextRotation] <Int32>] [-AutoSize] [[-Width] <Single>] [[-Height] <Single>] [-Hidden] [-Locked] [-Merge]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
|
||||
```text
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -ArrayFormula
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -AutoSize
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: AutoFit
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -BackgroundColor
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 15
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -BackgroundPattern
|
||||
|
||||
```yaml
|
||||
Type: ExcelFillStyle
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
Accepted values: None, Solid, DarkGray, MediumGray, LightGray, Gray125, Gray0625, DarkVertical, DarkHorizontal, DarkDown, DarkUp, DarkGrid, DarkTrellis, LightVertical, LightHorizontal, LightDown, LightUp, LightGrid, LightTrellis
|
||||
|
||||
Required: False
|
||||
Position: 16
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Bold
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -BorderAround
|
||||
|
||||
```yaml
|
||||
Type: ExcelBorderStyle
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
Accepted values: None, Hair, Dotted, DashDot, Thin, DashDotDot, Dashed, MediumDashDotDot, MediumDashed, MediumDashDot, Thick, Medium, Double
|
||||
|
||||
Required: False
|
||||
Position: 2
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -BorderBottom
|
||||
|
||||
```yaml
|
||||
Type: ExcelBorderStyle
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
Accepted values: None, Hair, Dotted, DashDot, Thin, DashDotDot, Dashed, MediumDashDotDot, MediumDashed, MediumDashDot, Thick, Medium, Double
|
||||
|
||||
Required: False
|
||||
Position: 4
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -BorderColor
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 3
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -BorderLeft
|
||||
|
||||
```yaml
|
||||
Type: ExcelBorderStyle
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
Accepted values: None, Hair, Dotted, DashDot, Thin, DashDotDot, Dashed, MediumDashDotDot, MediumDashed, MediumDashDot, Thick, Medium, Double
|
||||
|
||||
Required: False
|
||||
Position: 6
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -BorderRight
|
||||
|
||||
```yaml
|
||||
Type: ExcelBorderStyle
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
Accepted values: None, Hair, Dotted, DashDot, Thin, DashDotDot, Dashed, MediumDashDotDot, MediumDashed, MediumDashDot, Thick, Medium, Double
|
||||
|
||||
Required: False
|
||||
Position: 7
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -BorderTop
|
||||
|
||||
```yaml
|
||||
Type: ExcelBorderStyle
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
Accepted values: None, Hair, Dotted, DashDot, Thin, DashDotDot, Dashed, MediumDashDotDot, MediumDashed, MediumDashDot, Thick, Medium, Double
|
||||
|
||||
Required: False
|
||||
Position: 5
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -FontColor
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases: ForegroundColor
|
||||
|
||||
Required: False
|
||||
Position: 8
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -FontName
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 13
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -FontShift
|
||||
|
||||
```yaml
|
||||
Type: ExcelVerticalAlignmentFont
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
Accepted values: None, Baseline, Subscript, Superscript
|
||||
|
||||
Required: False
|
||||
Position: 12
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -FontSize
|
||||
|
||||
```yaml
|
||||
Type: Single
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 14
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Formula
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 10
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Height
|
||||
|
||||
```yaml
|
||||
Type: Single
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 22
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Hidden
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -HorizontalAlignment
|
||||
|
||||
```yaml
|
||||
Type: ExcelHorizontalAlignment
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
Accepted values: General, Left, Center, CenterContinuous, Right, Fill, Distributed, Justify
|
||||
|
||||
Required: False
|
||||
Position: 18
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Italic
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Locked
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Merge
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -NumberFormat
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases: NFormat
|
||||
|
||||
Required: False
|
||||
Position: 1
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -PatternColor
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases: PatternColour
|
||||
|
||||
Required: False
|
||||
Position: 17
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Range
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases: Address
|
||||
|
||||
Required: False
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -ResetFont
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -StrikeThru
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -TextRotation
|
||||
|
||||
```yaml
|
||||
Type: Int32
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 20
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -UnderLineType
|
||||
|
||||
```yaml
|
||||
Type: ExcelUnderLineType
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
Accepted values: None, Single, Double, SingleAccounting, DoubleAccounting
|
||||
|
||||
Required: False
|
||||
Position: 11
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Underline
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Value
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 9
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -VerticalAlignment
|
||||
|
||||
```yaml
|
||||
Type: ExcelVerticalAlignment
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
Accepted values: Top, Center, Bottom, Distributed, Justify
|
||||
|
||||
Required: False
|
||||
Position: 19
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Width
|
||||
|
||||
```yaml
|
||||
Type: Single
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 21
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -WrapText
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
---
|
||||
external help file: ImportExcel-help.xml
|
||||
Module Name: ImportExcel
|
||||
online version: null
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# New-Plot
|
||||
|
||||
## SYNOPSIS
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```text
|
||||
New-Plot
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
|
||||
```text
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
---
|
||||
external help file: ImportExcel-help.xml
|
||||
Module Name: ImportExcel
|
||||
online version: null
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# New-PSItem
|
||||
|
||||
## SYNOPSIS
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```text
|
||||
New-PSItem
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
|
||||
```text
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
||||
|
||||
@@ -1,113 +0,0 @@
|
||||
---
|
||||
external help file: ImportExcel-help.xml
|
||||
Module Name: ImportExcel
|
||||
online version: null
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Set-CellStyle
|
||||
|
||||
## SYNOPSIS
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```text
|
||||
Set-CellStyle [[-Worksheet] <Object>] [[-Row] <Object>] [[-LastColumn] <Object>] [[-Pattern] <ExcelFillStyle>]
|
||||
[[-Color] <Object>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
|
||||
```text
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -Color
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 4
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -LastColumn
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 2
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Pattern
|
||||
|
||||
```yaml
|
||||
Type: ExcelFillStyle
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
Accepted values: None, Solid, DarkGray, MediumGray, LightGray, Gray125, Gray0625, DarkVertical, DarkHorizontal, DarkDown, DarkUp, DarkGrid, DarkTrellis, LightVertical, LightHorizontal, LightDown, LightUp, LightGrid, LightTrellis
|
||||
|
||||
Required: False
|
||||
Position: 3
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Row
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 1
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Worksheet
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
||||
|
||||
@@ -1,329 +0,0 @@
|
||||
---
|
||||
external help file: ImportExcel-help.xml
|
||||
Module Name: ImportExcel
|
||||
online version: null
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Set-WorksheetProtection
|
||||
|
||||
## SYNOPSIS
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```text
|
||||
Set-WorksheetProtection [-Worksheet] <ExcelWorksheet> [-IsProtected] [-AllowAll] [-BlockSelectLockedCells]
|
||||
[-BlockSelectUnlockedCells] [-AllowFormatCells] [-AllowFormatColumns] [-AllowFormatRows] [-AllowInsertColumns]
|
||||
[-AllowInsertRows] [-AllowInsertHyperlinks] [-AllowDeleteColumns] [-AllowDeleteRows] [-AllowSort]
|
||||
[-AllowAutoFilter] [-AllowPivotTables] [-BlockEditObject] [-BlockEditScenarios] [[-LockAddress] <String>]
|
||||
[[-UnLockAddress] <String>] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
|
||||
```text
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -AllowAll
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -AllowAutoFilter
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -AllowDeleteColumns
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -AllowDeleteRows
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -AllowFormatCells
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -AllowFormatColumns
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -AllowFormatRows
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -AllowInsertColumns
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -AllowInsertHyperlinks
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -AllowInsertRows
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -AllowPivotTables
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -AllowSort
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -BlockEditObject
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -BlockEditScenarios
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -BlockSelectLockedCells
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -BlockSelectUnlockedCells
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -IsProtected
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -LockAddress
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 1
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -UnLockAddress
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 2
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Worksheet
|
||||
|
||||
```yaml
|
||||
Type: ExcelWorksheet
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about\_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
||||
|
||||
Reference in New Issue
Block a user