Compare commits

..

51 Commits

Author SHA1 Message Date
dfinke
5cd3897dfa fix png 2021-11-12 19:26:57 -05:00
dfinke
fe4f2848ad bump version 2021-11-12 19:23:36 -05:00
dfinke
4e89b3321a update change log 2021-11-12 19:23:31 -05:00
Doug Finke
43b6ebf84f Merge pull request #1101 from royashbrook/Read-OleDbData
Add ability to query with Oledb
2021-11-12 18:59:41 -05:00
dfinke
1ee9493bc0 Minor tweak. Display query executed 2021-11-12 17:25:45 -05:00
Roy Ashbrook
4fa6fbda01 update warning msg for Read-OleDbData 2021-11-09 09:05:15 -05:00
Roy Ashbrook
7177623104 add silent continue to cmd check tests 2021-11-08 18:21:11 -05:00
Roy Ashbrook
487cf51abc fix test skip label name 2021-11-08 18:19:23 -05:00
Roy Ashbrook
ae31e9d39b update skip/help msgs in invoke cmd 2021-11-08 18:08:45 -05:00
Roy Ashbrook
9ba20b8ec8 add back invoke tests, sync skip methods 2021-11-08 17:57:44 -05:00
Roy Ashbrook
9daefc2925 fix typo in skip logic 2021-11-08 17:45:33 -05:00
Roy Ashbrook
f0b4cb28f6 update tests to skip other pre-checks if linux/mac 2021-11-08 17:44:03 -05:00
Roy Ashbrook
5f00f5cbbc update tests 2021-11-08 17:40:33 -05:00
Roy Ashbrook
d41fbf8a05 updating tests 2021-11-08 17:13:40 -05:00
Roy Ashbrook
ebe49f1650 fix or/and 2021-11-08 16:56:23 -05:00
Roy Ashbrook
a3dced10e4 update tests 2021-11-08 16:37:00 -05:00
Roy Ashbrook
1e522c562b test skips for linux/macos, switch to warnings 2021-11-08 16:00:06 -05:00
Roy Ashbrook
5ec299ff2d some debugging messages for troubleshooting CI 2021-11-08 15:43:36 -05:00
Roy Ashbrook
676ecc17e0 update tests to match 2021-11-08 15:25:26 -05:00
Roy Ashbrook
aa1b0018ab Add examples 2021-11-08 15:14:46 -05:00
Roy Ashbrook
eabaab79c5 add ace check 2021-11-08 14:43:57 -05:00
Roy Ashbrook
7a8bbb9771 add to exported functions, formatting, fix typo. 2021-11-04 20:54:51 -04:00
Roy Ashbrook
85f2433ffc Rename helper function to make it more helpful. =) 2021-11-04 10:44:14 -04:00
Roy Ashbrook
5e7b404daf Add helper method 2021-11-03 10:35:22 -04:00
Roy Ashbrook
91a1240408 add skip test check for ace 2021-10-30 11:20:27 -04:00
Roy Ashbrook
e8c3d96f43 Tests relocated and updated. All passing. 2021-10-29 21:58:05 -04:00
Roy Ashbrook
9417b25af1 move tests into test folder 2021-10-29 16:58:16 -04:00
Roy Ashbrook
a942f2133d Add basic function, tests, and sample file 2021-10-29 13:21:52 -04:00
Doug Finke
533ed07ac8 Remove lowercase public
used for GitBook, no longer needed. #1082
2021-09-17 08:07:56 -04:00
Doug Finke
09f35b5fd5 Merge pull request #1078 from dfinke/Add-Checks-And-Warnings-for-Add-Member-Open-Excel-Package
Add-Checks-And-Warnings-for-Add-Member-Open-Excel-Package
2021-09-14 18:15:47 -04:00
dfinke
23a2ac394f Add try/catch, warning, and tests 2021-09-14 15:44:32 -04:00
dfinke
50928e8e3b Update 2021-09-14 15:44:11 -04:00
dfinke
26827b0764 bump version 2021-09-14 15:44:03 -04:00
Doug Finke
6c35d5b018 Updated 2021-09-10 18:41:03 -04:00
Doug Finke
ab5600c9ba bump version 2021-09-10 18:40:57 -04:00
Doug Finke
47dcc636d9 Merge pull request #1077 from stahler/Open-ExcelPackage
Update open-excelpackage.md
2021-09-10 18:39:00 -04:00
Stahler
1768c0ac92 Update open-excelpackage.md 2021-09-10 14:17:44 -04:00
Doug Finke
694fcdd8c1 Merge pull request #1059 from dfinke/add-test-for-ps-5-to-7-and-linux
Improved checks for Linux, Mac and PS 5.1 - #1056, #1057
2021-07-30 19:27:06 -04:00
dfinke
0192f4d822 Improved checks for Linux, Mac and PS 5.1 - #1056, #1057 2021-07-30 19:21:37 -04:00
dfinke
c641eea10a Improve auto-detection of data on the clipboard 2021-07-24 19:41:57 -04:00
dfinke
99de9a9854 Pass parameters from Read-Clipboard to implementation 2021-07-24 13:48:18 -04:00
Doug Finke
3121c5eaed Merge pull request #1054 from dfinke/Add-new-function-Read-Clipboard
Added Read-Clipboard
2021-07-24 13:37:32 -04:00
dfinke
d02f757568 add change log 2021-07-24 13:26:06 -04:00
dfinke
a693725949 Add Tests 2021-07-24 13:01:51 -04:00
dfinke
5e19d0ca1a Add ReadClipboardImpl function 2021-07-24 13:01:48 -04:00
dfinke
204b82144f Refactor for testing 2021-07-24 13:01:32 -04:00
dfinke
91eefbd48b Added Read-Clipboard 2021-07-24 11:20:04 -04:00
dfinke
f86556a89d Updated, added Open in VS Code badge 2021-07-10 08:46:36 -04:00
dfinke
14e1dfd8db Bump version. Use ProviderPath 2021-06-20 12:11:14 -04:00
Doug Finke
1d961c679e Merge pull request #1031 from sporkabob/master
Fix UNC paths for ConvertFrom-ExcelSheet
2021-05-13 15:54:39 -04:00
sporkabob
7026803415 Fix UNC paths for ConvertFrom-ExcelSheet 2021-05-13 15:22:15 -04:00
41 changed files with 657 additions and 2019 deletions

56
.vscode/launch.json vendored
View File

@@ -1,56 +0,0 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Pester Tests",
"script": "Import-Module -Name '.\\' -Force ; Invoke-Pester", // Change to '.\\ModuleName.psd1' if Git name different
"args": [""],
"cwd": "${workspaceFolder}"
},
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Launch Current File",
"script": "${file}",
"args": [],
"cwd": "${file}"
},
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Launch Current File in Temporary Console",
"script": "${file}",
"args": [],
"cwd": "${file}",
"createTemporaryIntegratedConsole": true
},
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Launch Current File w/Args Prompt",
"script": "${file}",
"args": [
"${command:SpecifyScriptArgs}"
],
"cwd": "${file}"
},
{
"type": "PowerShell",
"request": "attach",
"name": "PowerShell Attach to Host Process",
"processId": "${command:PickPSHostProcess}",
"runspaceId": 1
},
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Interactive Session",
"cwd": ""
}
]
}

View 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
}

Binary file not shown.

View File

@@ -6,7 +6,7 @@
RootModule = 'ImportExcel.psm1'
# Version number of this module.
ModuleVersion = '7.1.2'
ModuleVersion = '7.3.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',
@@ -78,7 +79,10 @@ Check out the How To Videos https://www.youtube.com/watch?v=U3Ne_yX4tYo&list=PL5
'Open-ExcelPackage',
'PieChart',
'Pivot',
'Remove-Worksheet'
'Read-Clipboard',
'ReadClipboardImpl',
'Read-OleDbData',
'Remove-Worksheet',
'Select-Worksheet',
'Send-SQLDataToExcel',
'Set-CellStyle',

View File

@@ -19,7 +19,7 @@ function ConvertFrom-ExcelSheet {
[string[]]$AsDate = @()
)
$Path = (Resolve-Path $Path).Path
$Path = (Resolve-Path $Path).ProviderPath
$xl = New-Object -TypeName OfficeOpenXml.ExcelPackage -ArgumentList $Path
$workbook = $xl.Workbook

View 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
}

View File

@@ -1,10 +1,10 @@
function Open-ExcelPackage {
function Open-ExcelPackage {
[CmdLetBinding()]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword","")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", "")]
[OutputType([OfficeOpenXml.ExcelPackage])]
param(
#The path to the file to open.
[Parameter(Mandatory=$true)]$Path,
[Parameter(Mandatory = $true)]$Path,
#If specified, any running instances of Excel will be terminated before opening the file.
[switch]$KillExcel,
#The password for a protected worksheet, as a [normal] string (not a secure string).
@@ -13,7 +13,7 @@
[switch]$Create
)
if($KillExcel) {
if ($KillExcel) {
Get-Process -Name "excel" -ErrorAction Ignore | Stop-Process
while (Get-Process -Name "excel" -ErrorAction Ignore) {}
}
@@ -24,21 +24,26 @@
#Create the directory if required.
$targetPath = Split-Path -Parent -Path $Path
if (!(Test-Path -Path $targetPath)) {
Write-Debug "Base path $($targetPath) does not exist, creating"
$null = New-item -ItemType Directory -Path $targetPath -ErrorAction Ignore
Write-Debug "Base path $($targetPath) does not exist, creating"
$null = New-item -ItemType Directory -Path $targetPath -ErrorAction Ignore
}
New-Object -TypeName OfficeOpenXml.ExcelPackage -ArgumentList $Path
}
elseif (Test-Path -Path $path) {
if ($Password) {$pkgobj = New-Object -TypeName OfficeOpenXml.ExcelPackage -ArgumentList $Path , $Password }
else {$pkgobj = New-Object -TypeName OfficeOpenXml.ExcelPackage -ArgumentList $Path }
if ($Password) { $pkgobj = New-Object -TypeName OfficeOpenXml.ExcelPackage -ArgumentList $Path , $Password }
else { $pkgobj = New-Object -TypeName OfficeOpenXml.ExcelPackage -ArgumentList $Path }
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
}
}
else {Write-Warning "Could not find $path" }
}
else { Write-Warning "Could not find $path" }
}

85
Public/Read-Clipboard.ps1 Normal file
View File

@@ -0,0 +1,85 @@
#Requires -Version 5
function Read-Clipboard {
<#
.SYNOPSIS
Read text from clipboard and pass to either ConvertFrom-Csv or ConvertFrom-Json.
Check out the how to video - https://youtu.be/dv2GOH5sbpA
.DESCRIPTION
Read text from clipboard. It can read CSV or JSON. Plus, you can specify the delimiter and headers.
.EXAMPLE
Read-Clipboard # Detects if the clipboard contains CSV, JSON, or Tab delimited data.
.EXAMPLE
Read-Clipboard -Delimiter '|' # Converts data using a pipe delimiter
.EXAMPLE
Read-Clipboard -Header 'P1', 'P2', 'P3' # Specify the header columns to be used
#>
param(
$Delimiter,
$Header
)
if ($IsLinux -or $IsMacOS) {
Write-Error "Read-Clipboard only runs on Windows"
return
}
$cvtParams = @{
Data = Get-Clipboard -Raw
}
if ($Delimiter) {
$cvtParams.Delimiter = $Delimiter
}
if ($Header) {
$cvtParams.Header = $Header
}
ReadClipboardImpl @cvtParams
}
function ReadClipboardImpl {
param(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String] $data,
$Delimiter,
$Header
)
if (!$PSBoundParameters.ContainsKey('Delimiter') -and !$PSBoundParameters.ContainsKey('Header')) {
try {
ConvertFrom-Json $data
}
catch {
$dataLines = @($data -split "`r`n?" | Select-Object -First 1)
if ($dataLines[0].indexOf(',') -gt -1) {
ConvertFrom-Csv $data
}
else {
ConvertFrom-Csv $data -Delimiter "`t"
}
}
}
else {
$cvtParams = @{
InputObject = $data
}
if ($Delimiter) {
$cvtParams.Delimiter = $Delimiter
}
if ($Header) {
$cvtParams.Header = $Header
}
ConvertFrom-Csv @cvtParams
}
}

54
Public/Read-OleDbData.ps1 Normal file
View 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
}

6
PublishToGallery.ps1 Normal file
View File

@@ -0,0 +1,6 @@
$p = @{
Name = "ImportExcel"
NuGetApiKey = $NuGetApiKey
}
Publish-Module @p

View File

@@ -1,14 +1,18 @@
# README
# PowerShell + Excel = Better Together
### Donation
Automate Excel via PowerShell without having Excel installed. Runs on Windows, Linux and MAC. Creating Tables, Pivot Tables, Charts and much more has just become a lot easier.
If this project helped you reduce the time to get your job done, let me know.
<br/>
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UCSB9YVPFSNCY)
[![](https://img.shields.io/powershellgallery/v/ImportExcel.svg)](https://www.powershellgallery.com/packages/ImportExcel) [![](https://img.shields.io/powershellgallery/dt/ImportExcel.svg)](https://www.powershellgallery.com/packages/ImportExcel) [![](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/dfinke/ImportExcel/tree/70ab9e46c776e96fb287682d5b9b4b51a0ec3bac/LICENSE.txt)
![](https://media.giphy.com/media/hpXxJ78YtpT0s/giphy.gif)
<br/>
[![](https://img.shields.io/powershellgallery/v/ImportExcel.svg)](https://www.powershellgallery.com/packages/ImportExcel) [![](https://img.shields.io/powershellgallery/dt/ImportExcel.svg)](https://www.powershellgallery.com/packages/ImportExcel) [![](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/dfinke/ImportExcel/tree/70ab9e46c776e96fb287682d5b9b4b51a0ec3bac/LICENSE.txt)
Open `ImportExcel` as a remote repo in VS Code, without cloning it.
[![Open in Visual Studio Code](https://open.vscode.dev/badges/open-in-vscode.svg)](https://open.vscode.dev/dfinke/importexcel)
<br/>
| CI System | Environment | Status |
| :--- | :--- | :--- |
@@ -17,11 +21,22 @@ If this project helped you reduce the time to get your job done, let me know.
| Azure DevOps | Ubuntu | [![Build Status](https://dougfinke.visualstudio.com/ImportExcel/_apis/build/status/dfinke.ImportExcel?branchName=master&jobName=Ubuntu)](https://dougfinke.visualstudio.com/ImportExcel/_build/latest?definitionId=21&branchName=master) |
| Azure DevOps | macOS | [![Build Status](https://dougfinke.visualstudio.com/ImportExcel/_apis/build/status/dfinke.ImportExcel?branchName=master&jobName=macOS)](https://dougfinke.visualstudio.com/ImportExcel/_build/latest?definitionId=21&branchName=master) |
PowerShell Import-Excel -
<br/>
Install from the [PowerShell Gallery](https://www.powershellgallery.com/packages/ImportExcel/).
This PowerShell Module allows you to read and write Excel files without installing Microsoft Excel on your system. No need to bother with the cumbersome Excel COM-object. Creating Tables, Pivot Tables, Charts and much more has just become a lot easier.
```powershell
Install-Module -Name ImportExcel
```
### Donation
If this project helped you reduce the time to get your job done, let me know, send a coffee.
<br/>
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UCSB9YVPFSNCY)
![](https://media.giphy.com/media/hpXxJ78YtpT0s/giphy.gif)
![](https://raw.githubusercontent.com/dfinke/ImportExcel/master/images/testimonial.png)
@@ -55,6 +70,10 @@ Plus, wiring the [PowerShell ScriptAnalyzer Excel report](https://github.com/dfi
![](.gitbook/assets/ScriptAnalyzerReport.png)
## What's new 7.1.3
- Changed to `ProviderPath`. Thanks [Trevor Walker](https://github.com/sporkabob)
## What's new 7.1.2
- `Get-ExcelFileSummary` - Gets summary information on an Excel file like number of rows, columns, and more

View 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
}
}

View File

@@ -0,0 +1,90 @@
#Requires -Modules Pester
# if (-not (Get-command Import-Excel -ErrorAction SilentlyContinue)) {
Import-Module $PSScriptRoot\..\ImportExcel.psd1 -Force
# }
Describe "Read Clipboard" -Tag "Read-Clipboard" {
It 'Should return $null if it cannot detect data format on the clipboard' {
$testData = 'abc'
$actual = ReadClipboardImpl $testData
$actual.Count | Should -Be 0
$actual | Should -BeNullOrEmpty
}
It 'Should return converted csv data' {
$testData = @"
Region,State,Units,Price
West,Texas,927,923.71
North,Tennessee,466,770.67
East,Florida,520,458.68
"@
$actual = ReadClipboardImpl $testData
$actual.count | Should -Be 3
}
It 'Should return converted tab delimited data' {
$testData = @"
YEAR PRESIDENT FIRST LADY VICE PRESIDENT
2021- Joseph R. Biden Jill Biden Kamala Harris
2017-2021 Donald J. Trump Melania Trump Mike Pence
2009-2017 Barack Obama Michelle Obama Joseph R. Biden
"@
$actual = ReadClipboardImpl $testData
$actual.count | Should -Be 3
}
It 'Should return converted json data' {
$testData = @"
[
{
"YEAR": "2021-",
"PRESIDENT": "Joseph R. Biden",
"FIRST LADY": "Jill Biden",
"VICE PRESIDENT": "Kamala Harris"
},
{
"YEAR": "2017-2021",
"PRESIDENT": "Donald J. Trump",
"FIRST LADY": "Melania Trump",
"VICE PRESIDENT": "Mike Pence"
},
{
"YEAR": "2009-2017",
"PRESIDENT": "Barack Obama",
"FIRST LADY": "Michelle Obama",
"VICE PRESIDENT": "Joseph R. Biden"
}
]
"@
$actual = ReadClipboardImpl $testData
$actual.count | Should -Be 3
}
It 'Should return converted "|" delimited data' {
$testData = @"
Region|State|Units|Price
West|Texas|927|923.71
North|Tennessee|466|770.67
East|Florida|520|458.68
"@
$actual = ReadClipboardImpl $testData -Delimiter '|'
$actual.count | Should -Be 3
}
It 'Should return converted data with headers' {
$testData = @"
West,Texas,927,923.71
North,Tennessee,466,770.67
East,Florida,520,458.68
"@
$actual = ReadClipboardImpl $testData -Header 'P1', 'P2', 'p3', 'P4'
$actual.count | Should -Be 3
$propertyNames = $actual[0].psobject.Properties.Name
$propertyNames[0] | Should -BeExactly 'P1'
$propertyNames[1] | Should -BeExactly 'P2'
$propertyNames[2] | Should -BeExactly 'p3'
$propertyNames[3] | Should -BeExactly 'P4'
}
}

View 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
}
}
}

View File

@@ -0,0 +1,4 @@
select
ROUND(F1) as [A1]
from
[sheet3$A1:A1]

View 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]

View File

@@ -0,0 +1,4 @@
select
*
from
[sheet1$A1:E10]

View 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]

View 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]

View 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
}
}
}

Binary file not shown.

Binary file not shown.

60
changelog.md Normal file
View File

@@ -0,0 +1,60 @@
# 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
```
![](./images/SQL-Spreadsheet.png)
## 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.
### Check out the video
<a href="https://youtu.be/dv2GOH5sbpA"><img src="https://img.youtube.com/vi/dv2GOH5sbpA/0.jpg" width="400"></a>

BIN
images/SQL-Spreadsheet.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -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

View File

@@ -1,2 +0,0 @@
# Public

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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