source stringclasses 1
value | repo stringclasses 33
values | repo_url stringclasses 33
values | path stringlengths 7 179 | language stringclasses 1
value | license stringclasses 4
values | stars int64 2.27k 53.4k | ref stringclasses 4
values | size_bytes int64 48 259k | text stringlengths 48 259k |
|---|---|---|---|---|---|---|---|---|---|
github | FuzzySecurity/PowerShell-Suite | https://github.com/FuzzySecurity/PowerShell-Suite | Invoke-SMBShell.ps1 | PowerShell | bsd-3-clause | 2,715 | master | 7,378 | function Invoke-SMBShell {
<#
.SYNOPSIS
Invoke-SMBShell uses named pipes to create an SMB C2 channel. The SMB
traffic is encrypted using AES CBC (code from Empire), the key/pipe
are generated randomly by the server on start-up.
This is a crude POC, in the wild malware like Duqu or ProjectSauron
use this technique... |
github | FuzzySecurity/PowerShell-Suite | https://github.com/FuzzySecurity/PowerShell-Suite | Stage-RemoteDll.ps1 | PowerShell | bsd-3-clause | 2,715 | master | 28,375 | function Stage-RemoteDll {
<#
.SYNOPSIS
Stage-RemoteDll is a small function to demonstrate various Dll injection techniques
(NtCreateThreadEx / QueueUserAPC / SetThreadContext / SetWindowsHookEx) on 32 and
64 bit architectures. While I have done some input validation & cleanup, this is
mostly POC code. Note also th... |
github | FuzzySecurity/PowerShell-Suite | https://github.com/FuzzySecurity/PowerShell-Suite | Conjure-LSASS.ps1 | PowerShell | bsd-3-clause | 2,715 | master | 5,838 | function Conjure-LSASS {
<#
.SYNOPSIS
Use the SeDebugPrivilege to duplicate the LSASS access token and
impersonate it in the calling thread. If SeDebugPrivilege is disabled
the function will re-enable it.
If SeDebugPrivilege has been removed, it can be added using LsaAddAccountRights
however t... |
github | FuzzySecurity/PowerShell-Suite | https://github.com/FuzzySecurity/PowerShell-Suite | Get-CRC32.ps1 | PowerShell | bsd-3-clause | 2,715 | master | 1,042 | function Get-CRC32 {
<#
.SYNOPSIS
Simple wrapper for undocumented RtlComputeCrc32 function.
.DESCRIPTION
Author: Ruben Boonen (@FuzzySec)
License: BSD 3-Clause
Required Dependencies: None
Optional Dependencies: None
.PARAMETER InitialCRC
Optional initial CRC value to start with. Supply 0 initially.
.PARAMETER ... |
github | FuzzySecurity/PowerShell-Suite | https://github.com/FuzzySecurity/PowerShell-Suite | Native-HardLink.ps1 | PowerShell | bsd-3-clause | 2,715 | master | 7,076 | function Native-HardLink {
<#
.SYNOPSIS
This is a proof-of-concept for NT hard links. There are some advantages, from an offensive
perspective, to using NtSetInformationFile to create hard links (as opposed to
mklink/CreateHardLink). NtSetInformationFile allows us link to files we don’t have write
access to. In the... |
github | FuzzySecurity/PowerShell-Suite | https://github.com/FuzzySecurity/PowerShell-Suite | Calculate-Hash.ps1 | PowerShell | bsd-3-clause | 2,715 | master | 1,705 | function Calculate-Hash {
<#
.SYNOPSIS
PowerShell v2 compatible script to calculate file hashes.
.PARAMETER Path
Path to file.
.PARAMETER Algorithm
Algorithm to use: MD5, RIPEMD160, SHA1, SHA256, SHA384, SHA512. If the algorithm parameter is not specified both MD5 and SHA256 will be shown.
.DESCR... |
github | FuzzySecurity/PowerShell-Suite | https://github.com/FuzzySecurity/PowerShell-Suite | Detect-Debug.ps1 | PowerShell | bsd-3-clause | 2,715 | master | 8,357 | function Detect-Debug {
<#
.SYNOPSIS
Use several techniques to detect the presence of a debugger. I realise
this does not make much sense from PowerShell (you may as well detect a
text editor..) but there you go :)!
Notes:
* Using Kernel32::OutputDebugString does not appear to work in PowerShell.
In theo... |
github | FuzzySecurity/PowerShell-Suite | https://github.com/FuzzySecurity/PowerShell-Suite | Export-LNKPwn.ps1 | PowerShell | bsd-3-clause | 2,715 | master | 51,221 | function Export-LNKPwn {
<#
.SYNOPSIS
Create LNK files to exploit CVE-2017-8464 aka LNK round 3 ;))!
Currently, it is recommended that you create the lnk locally
and then move it to the target system.
Notes:
- For now both .NET libraries require version 4.0+, and I
am using some constructors (eg new()) which... |
github | FuzzySecurity/PowerShell-Suite | https://github.com/FuzzySecurity/PowerShell-Suite | Get-Handles.ps1 | PowerShell | bsd-3-clause | 2,715 | master | 13,690 | function Get-Handles {
<#
.SYNOPSIS
Use NtQuerySystemInformation::SystemHandleInformation to get a list of
open handles in the specified process, works on x32/x64.
Notes:
* For more robust coding I would recomend using @mattifestation's
Get-NtSystemInformation.ps1 part of PowerShellArsenal.
.DESCRIPTION
Author:... |
github | FuzzySecurity/PowerShell-Suite | https://github.com/FuzzySecurity/PowerShell-Suite | Get-Exports.ps1 | PowerShell | bsd-3-clause | 2,715 | master | 7,012 | function Get-Exports {
<#
.SYNOPSIS
Get-Exports, fetches DLL exports and optionally provides
C++ wrapper output (idential to ExportsToC++ but without
needing VS and a compiled binary). To do this it reads DLL
bytes into memory and then parses them (no LoadLibraryEx).
Because of this you can parse x32/x64 DLL's regardle... |
github | FuzzySecurity/PowerShell-Suite | https://github.com/FuzzySecurity/PowerShell-Suite | Invoke-NetSessionEnum.ps1 | PowerShell | bsd-3-clause | 2,715 | master | 2,976 | function Invoke-NetSessionEnum {
<#
.SYNOPSIS
Use Netapi32::NetSessionEnum to enumerate active sessions on domain joined machines.
.DESCRIPTION
Author: Ruben Boonen (@FuzzySec)
License: BSD 3-Clause
Required Dependencies: None
Optional Dependencies: None
.EXAMPLE
C:\PS> Invoke-NetSessionEnum -HostName SomeHos... |
github | FuzzySecurity/PowerShell-Suite | https://github.com/FuzzySecurity/PowerShell-Suite | Start-Hollow.ps1 | PowerShell | bsd-3-clause | 2,715 | master | 26,384 | function Start-Hollow {
<#
.SYNOPSIS
This is a proof-of-concept for process hollowing. There is nothing new here except
maybe the use of NtCreateProcessEx which has some advantages in that it offers a
convenient way to set a parent process and avoids the bothersome Get/SetThreadContext.
On the flipside CreateRemote... |
github | FuzzySecurity/PowerShell-Suite | https://github.com/FuzzySecurity/PowerShell-Suite | UAC-TokenMagic.ps1 | PowerShell | bsd-3-clause | 2,715 | master | 10,720 | function UAC-TokenMagic {
<#
.SYNOPSIS
Based on James Forshaw's three part post on UAC, linked below, and possibly a technique
used by the CIA!
Essentially we duplicate the token of an elevated process, lower it's mandatory
integrity level, use it to create a new restricted token, impersonate it and
use the Seco... |
github | FuzzySecurity/PowerShell-Suite | https://github.com/FuzzySecurity/PowerShell-Suite | Invoke-CreateProcess.ps1 | PowerShell | bsd-3-clause | 2,715 | master | 6,164 | function Invoke-CreateProcess {
<#
.SYNOPSIS
-Binary Full path of the module to be executed.
-Args Arguments to pass to the module, e.g. "/c calc.exe". Defaults
to $null if not specified.
-CreationFlags P... |
github | FuzzySecurity/PowerShell-Suite | https://github.com/FuzzySecurity/PowerShell-Suite | Masquerade-PEB.ps1 | PowerShell | bsd-3-clause | 2,715 | master | 12,031 | function Masquerade-PEB {
<#
.SYNOPSIS
Masquerade-PEB uses NtQueryInformationProcess to get a handle to powershell's
PEB. From there itreplaces a number of UNICODE_STRING structs in memory to
give powershell the appearance of a different process. Specifically, the
function will overwrite powershell's "I... |
github | FuzzySecurity/PowerShell-Suite | https://github.com/FuzzySecurity/PowerShell-Suite | Bypass-UAC/Bypass-UAC.ps1 | PowerShell | bsd-3-clause | 2,715 | master | 84,149 | function Bypass-UAC {
<#
.SYNOPSIS
Bypass-UAC provides a framework to perform UAC bypasses based on auto
elevating IFileOperation COM object method calls. This is not a new
technique, traditionally, this is accomplished by injecting a DLL into
"explorer.exe". This is not desirable because injecting into
explorer may tr... |
github | FuzzySecurity/PowerShell-Suite | https://github.com/FuzzySecurity/PowerShell-Suite | Bypass-UAC/Yamabiko/Out-UnmanagedDll.ps1 | PowerShell | bsd-3-clause | 2,715 | master | 1,686 | function Out-UnmanagedDll
{
[CmdletBinding()] Param (
[Parameter(Mandatory = $True)]
[String]
$FilePath
)
$Path = Resolve-Path $FilePath
if (! [IO.File]::Exists($Path))
{
Throw "$Path does not exist."
}
$FileBytes = [System.IO.File]::ReadAllBytes($Path)
... |
github | FuzzySecurity/PowerShell-Suite | https://github.com/FuzzySecurity/PowerShell-Suite | Bypass-UAC/FileOperations/Out-ManagedDll.ps1 | PowerShell | bsd-3-clause | 2,715 | master | 1,506 | function Out-ManagedDll
{
[CmdletBinding()] Param (
[Parameter(Mandatory = $True)]
[String]
$FilePath
)
$Path = Resolve-Path $FilePath
if (! [IO.File]::Exists($Path))
{
Throw "$Path does not exist."
}
$FileBytes = [System.IO.File]::ReadAllBytes($Path)
... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | ImportExcel.psm1 | PowerShell | apache-2.0 | 2,711 | master | 2,069 | #region import everything we need
$culture = $host.CurrentCulture.Name -replace '-\w*$', ''
Import-LocalizedData -UICulture $culture -BindingVariable Strings -FileName Strings -ErrorAction Ignore
if (-not $Strings) {
Import-LocalizedData -UICulture "en" -BindingVariable Strings -FileName Strings -ErrorAction Ign... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Plot.ps1 | PowerShell | apache-2.0 | 2,711 | master | 5,901 | [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification="False positives")]
param()
class PSPlot {
hidden $path
hidden $pkg
hidden $ws
hidden $chart
PSPlot() {
$this.path=[System.IO.Path]::GetTempFileName() -replace "\.tmp", ".xlsx"
... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | PublishToGallery.ps1 | PowerShell | apache-2.0 | 2,711 | master | 96 | $p = @{
Name = "ImportExcel"
NuGetApiKey = $NuGetApiKey
}
Publish-Module @p |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | GetExcelTable.ps1 | PowerShell | apache-2.0 | 2,711 | master | 2,801 | function Get-ExcelTableName {
param(
$Path,
$WorksheetName
)
$Path = (Resolve-Path $Path).ProviderPath
$Stream = New-Object -TypeName System.IO.FileStream -ArgumentList $Path, 'Open', 'Read', 'ReadWrite'
$Excel = New-Object -TypeName OfficeOpenXml.ExcelPackage -ArgumentList $Stream... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | ImportExcel.psd1 | PowerShell | apache-2.0 | 2,711 | master | 7,098 | @{
# Assemblies that must be loaded prior to importing this module
RequiredAssemblies = @('.\EPPlus.dll')
# Script module or binary module file associated with this manifest.
RootModule = 'ImportExcel.psm1'
# Version number of this module.
ModuleVersion = '7.8.10'
# ID used t... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | InstallModule.ps1 | PowerShell | apache-2.0 | 2,711 | master | 691 | param ($fullPath)
#$fullPath = 'C:\Program Files\WindowsPowerShell\Modules\ImportExcel'
if (-not $fullPath) {
$fullpath = $env:PSModulePath -split ":(?!\\)|;|," |
Where-Object {$_ -notlike ([System.Environment]::GetFolderPath("UserProfile")+"*") -and $_ -notlike "$pshome*"} |
Select-Object -Firs... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Export-charts.ps1 | PowerShell | apache-2.0 | 2,711 | master | 2,653 | <#
.Synopsis
Exports the charts in an Excel spreadSheet
.Example
Export-Charts .\test.xlsx
Exports the charts in test.xlsx to JPEG files in the current directory.
.Example
Export-Charts -path .\test,xlsx -destination [System.Environment+SpecialFolder]::MyDocuments -output... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Add-Subtotals.ps1 | PowerShell | apache-2.0 | 2,711 | master | 6,552 | Function Add-Subtotals {
param(
[Parameter(Mandatory=$true, Position=0)]
$ChangeColumnName , # = "Location"
[Parameter(Mandatory=$true, Position=1)]
[hashtable]$AggregateColumn , #= @{"Sales" = "SUM" }
[Parameter(Position=2)]
$ExcelPath = ... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Export-StocksToExcel.ps1 | PowerShell | apache-2.0 | 2,711 | master | 1,012 | function Export-StocksToExcel {
param(
[string]$symbols,
[ValidateSet("Open", "High", "Low", "Close", "Volume")]
$measure = "Open"
)
$xl = Join-Path ([IO.Path]::GetTempPath()) 'Stocks.xlsx'
Remove-Item $xl -ErrorAction SilentlyContinue
$r = Invoke-RestMethod "https://azfn... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | CI/CI.ps1 | PowerShell | apache-2.0 | 2,711 | master | 10,549 | <#
.SYNOPSIS
Handel Continuous Integration Testing in AppVeyor and Azure DevOps Pipelines.
#>
param
(
# AppVeyor Only - Update AppVeyor build name.
[Switch]$Initialize,
# Installs the module and invoke the Pester tests with the current version of PowerShell.
[Switch]$Test,
# AppVeyor Only - ... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | CI/Publish.ps1 | PowerShell | apache-2.0 | 2,711 | master | 4,123 | <#
.SYNOPSIS
Deploy module to PowerShellGallery.
#>
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseDeclaredVarsMoreThanAssignments", "Success")]
[CmdletBinding(DefaultParameterSetName = 'ModuleName')]
Param
(
# The name of the installed module to be deployed, if not provided the name of the .psm1 ... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | CI/Test-SingleFunctions.ps1 | PowerShell | apache-2.0 | 2,711 | master | 2,713 |
function Test-SingleFunction {
param (
[parameter(ValueFromPipeline=$true)]
$path )
begin {
$psd = Get-Content -Raw "$PSScriptRoot\..\ImportExcel.psd1"
$exportedFunctions = (Invoke-Command ([scriptblock]::Create($psd))).functionsToExport
$reg = [Regex]::new(@"
funct... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | CI/InstallPowerShell.ps1 | PowerShell | apache-2.0 | 2,711 | master | 1,068 | <#
.SYNOPSIS
Installs PowerShell Core on Windows.
#>
[CmdLetBinding()]
Param
(
# Version to install in the format from the .msi, for example "7.0.0-preview.1"
[String]$Version
)
$ErrorActionPreference = 'Stop'
if (-not $Version) {
$Version = (Invoke-RestMethod https://raw.githubusercontent.com/Powe... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | CI/build.ps1 | PowerShell | apache-2.0 | 2,711 | master | 3,291 | [CmdletBinding(DefaultParameterSetName = 'Default')]
param(
# Path to install the module to, if not provided -Scope used.
[Parameter(Mandatory, ParameterSetName = 'ModulePath')]
[ValidateNotNullOrEmpty()]
[String]$ModulePath,
# Path to install the module to, PSModulePath "CurrentUser" or "AllUsers"... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | CI/PS-CI.ps1 | PowerShell | apache-2.0 | 2,711 | master | 12,802 | [cmdletbinding(DefaultParameterSetName = 'Scope')]
Param(
[Parameter(Mandatory = $true, ParameterSetName = 'ModulePath')]
[ValidateNotNullOrEmpty()]
[String]$ModulePath,
# Path to install the module to, PSModulePath "CurrentUser" or "AllUsers", if not provided "CurrentUser" used.
[Parameter(Paramet... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | CI/Install.ps1 | PowerShell | apache-2.0 | 2,711 | master | 7,234 | <#
.SYNOPSIS
Installs module from Git clone or directly from GitHub.
File must not have BOM for GitHub deploy to work.
#>
[CmdletBinding(DefaultParameterSetName = 'Default')]
param(
# Path to install the module to, if not provided -Scope used.
[Parameter(Mandatory, ParameterSetName = 'ModulePath')]
... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Pivot/Pivot.ps1 | PowerShell | apache-2.0 | 2,711 | master | 567 | function Pivot {
[CmdletBinding()]
param(
$targetData,
$pivotRows,
$pivotData,
[OfficeOpenXml.Drawing.Chart.eChartType]$ChartType="Pie"
)
if(!$pivotData) {$pivotData=$pivotRows}
$xlFile = [System.IO.Path]::GetTempFileName() -replace "tmp","xlsx"
Write-Verbose $x... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Private/Invoke-ExcelReZipFile.ps1 | PowerShell | apache-2.0 | 2,711 | master | 1,005 | 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' -ErrorActi... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Private/ArgumentCompletion.ps1 | PowerShell | apache-2.0 | 2,711 | master | 12,575 | function ColorCompletion {
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
[System.Drawing.KnownColor].GetFields() | Where-Object {$_.IsStatic -and $_.name -like "$wordToComplete*" } |
Sort-Object name | ForEach-Object {New-CompletionResult $_.name $_.name
}
}... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | InferData/InferData.ps1 | PowerShell | apache-2.0 | 2,711 | master | 2,002 | function Test-String{
param($p)
[PSCustomObject]@{
Test=$p -is [string]
DataType = "string"
}
}
function Test-Date {
param($p)
[datetime]$result = [datetime]::MinValue
[PSCustomObject]@{
Test=[datetime]::TryParse($p, [ref]$result)
DataType = "datetime"
}
... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | mdHelp/buildHelp.ps1 | PowerShell | apache-2.0 | 2,711 | master | 194 | Import-Module platyPS
Get-ChildItem $PSScriptRoot -Directory | ForEach-Object {
New-ExternalHelp -Path $_.FullName -OutputPath (Join-Path $PSScriptRoot "..\$($_.Name)") -Force -Verbose
} |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/Get-ExcelFileSchema.tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 1,914 | if (-not (Get-command Import-Excel -ErrorAction SilentlyContinue)) {
Import-Module $PSScriptRoot\..\ImportExcel.psd1
}
Describe "Test getting the schema of an Excel file" -Tag GetExcelFileSchema {
BeforeAll {
$script:excelFile = "TestDrive:\test.xlsx"
$data = ConvertFrom-Csv @"
Region,State,Un... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/Get-ExcelColumnName.Test.ps1 | PowerShell | apache-2.0 | 2,711 | master | 727 | $map = @{
1024 = 'AMJ'
2048 = 'BZT'
3072 = 'DND'
4096 = 'FAN'
5120 = 'GNX'
6144 = 'IBH'
7168 = 'JOR'
8192 = 'LCB'
9216 = 'MPL'
10240 = 'OCV'
11264 = 'PQF'
12288 = 'RDP'
13312 = 'SQZ'
14336 = 'UEJ'
15360 = 'VRT'
16384 = 'XFD'
}
(Get-ExcelColumnNam... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/ImportExcelHeaderName.tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 15,184 | #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 = "$PSScriptRoot\testImportExcel.xlsx"
$xlfileHeaderOnly = "$PSScriptRoot\... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/RangePassing.Tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 12,124 | #Requires -Modules Pester
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification = 'False Positives')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingCmdletAliases', '', Justification = 'Testing for presence of alias')]
param()
describe "Consistent... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/ExtraLongCmd.tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 4,803 | Describe "Creating workbook with a single line" {
BeforeAll {
$path = "TestDrive:\test.xlsx"
remove-item -path $path -ErrorAction SilentlyContinue
ConvertFrom-Csv @"
Product, City, Gross, Net
Apple, London , 300, 250
Orange, London , 400, 350
Banana, London , 300, 200
Orange, Paris, 600... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/Remove-WorkSheet.tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 2,920 | #Requires -Modules Pester
if (-not (Get-command Import-Excel -ErrorAction SilentlyContinue)) {
Import-Module $PSScriptRoot\..\ImportExcel.psd1
}
Describe "Remove Worksheet" {
Context "Remove a worksheet output" {
BeforeEach {
# Create three sheets
$data = ConvertFrom-Csv @"
Name... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/Validation.tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 3,780 | Describe "Data validation and protection" {
Context "Data Validation rules" {
BeforeAll {
$data = ConvertFrom-Csv -InputObject @"
ID,Product,Quantity,Price
12001,Nails,37,3.99
12002,Hammer,5,12.10
12003,Saw,12,15.37
12010,Drill,20,8
... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/Read-Clipboard.tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 2,566 | #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'
... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/Join-Worksheet.tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 12,060 | #Requires -Modules Pester
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification = 'False Positives')]
param()
Describe "Join Worksheet part 1" {
BeforeAll {
$data1 = ConvertFrom-Csv -InputObject @"
ID,Product,Quantity,Price,Total
12001,... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/ConvertFromExcelToSQLInsert.tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 1,034 | if (-not (Get-command Import-Excel -ErrorAction SilentlyContinue)) {
Import-Module $PSScriptRoot\..\ImportExcel.psd1
}
Describe "ConvertFrom-ExcelToSQLInsert" {
BeforeAll {
$script:xlFile = "TestDrive:\testSQL.xlsx"
}
BeforeEach {
$([PSCustomObject]@{
Name = "John"... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/FunctionAlias.tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 797 | #Requires -Modules Pester
if (-not (Get-command Import-Excel -ErrorAction SilentlyContinue)) {
Import-Module $PSScriptRoot\..\ImportExcel.psd1
}
Describe "Check if Function aliases exist" {
It "Set-Column should exist".PadRight(90) {
${Alias:Set-Column} | Should -Not -BeNullOrEmpty
}
It "Set-... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/PasswordProtection.tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 1,478 |
Describe "Password Support" {
if ($PSVersionTable.PSVersion.Major -GT 5) {
It "Password Supported" {
Set-ItResult -Pending -Because "Can't test passwords on V6 and later"
}
return
}
Context "Password protected sheet" {
BeforeAll {
$password = "YouM... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/Path.tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 1,504 | Describe "Test reading relative paths" {
BeforeAll {
$script:xlfileName = "TestR.xlsx"
If ([String]::IsNullOrEmpty($PWD)) { $PWD = $PSScriptRoot }
@{data = 1 } | Export-Excel (Join-Path $PWD "TestR.xlsx")
}
AfterAll {
Remove-Item (Join-Path $PWD "$($script:xlfileName)")
... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/First10Races.tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 16,767 |
Describe "Creating small named ranges with hyperlinks" {
BeforeAll {
$scriptPath = $PSScriptRoot
$dataPath = Join-Path -Path $scriptPath -ChildPath "First10Races.csv"
$WarningAction = "SilentlyContinue"
$path = "TestDrive:\Results.xlsx"
Remove-Item -Path $path -ErrorAction... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/ConvertFrom-ExcelSheet.Tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 3,111 | Describe 'ConvertFrom-ExcelSheet / Export-ExcelSheet' {
BeforeAll {
$scriptPath = $PSScriptRoot
$dataPath = Join-Path -Path $scriptPath -ChildPath "First10Races.xlsx"
$Outpath = "TestDrive:\"
ConvertFrom-ExcelSheet -Path $dataPath -OutputPath $Outpath
$script:firstText = Ge... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/Set-Row_Set-Column-SetFormat.tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 27,267 |
Describe "Number format expansion and setting" {
BeforeAll {
$path = "TestDrive:\test.xlsx"
$data = ConvertFrom-Csv -InputObject @"
ID,Product,Quantity,Price
12001,Nails,37,3.99
12002,Hammer,5,12.10
12003,Saw,12,15.37
12010,Drill,20,8
12011,Crowbar... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/ProtectWorksheet.tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 1,557 | Describe "Setting worksheet protection " {
BeforeAll {
$path = "TestDrive:\test.xlsx"
Remove-Item -path $path -ErrorAction SilentlyContinue
$excel = ConvertFrom-Csv @"
Product, City, Gross, Net
Apple, London , 300, 250
Orange, London , 400, 350
Banana, London , 300, 200
Orange, Paris, 6... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/Open-ExcelPackage.tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 708 | #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
Encrypt... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/Copy-ExcelWorksheet.Tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 8,370 | [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification = 'False Positives')]
param()
Describe "Copy-Worksheet" {
BeforeAll {
$path1 = "TestDrive:\Test1.xlsx"
$path2 = "TestDrive:\Test2.xlsx"
Remove-Item -Path $path1, $path2 -ErrorActio... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/Get-ExcelFileSummary.Tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 2,425 | #Requires -Modules Pester
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification = 'False Positives')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidAssignmentToAutomaticVariable', '', Justification = 'Only executes on versions without the automatic va... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/InputItemParameter.tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 13,650 | # [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments','',Justification='False Positives')]
# Param()
# Describe "Exporting with -Inputobject, table handling, Send-SQL-Data. Checking Import -asText" {
# BeforeAll {
# $path = "TestDrive:\Results.xlsx"
# $path2 = ... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/Export-Excel.Tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 88,028 | #Requires -Modules @{ ModuleName="Pester"; ModuleVersion="4.0.0" }
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification = 'False Positives')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidAssignmentToAutomaticVariable', '', Justification = 'Only exec... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/Compare-WorkSheet.tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 27,197 | #Requires -Modules Pester
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments','',Justification='False Positives')]
param()
if (-not (Get-command Import-Excel -ErrorAction SilentlyContinue)) {
Import-Module $PSScriptRoot\..\ImportExcel.psd1
}
Describe "Compare Worksheet" {
... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/AddTrendlinesToAChart.tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 1,562 | if (-not (Get-command Import-Excel -ErrorAction SilentlyContinue)) {
Import-Module $PSScriptRoot\..\ImportExcel.psd1
}
Describe "Test adding trendlines to charts" {
BeforeAll {
$script:data = ConvertFrom-Csv @"
Region,Item,TotalSold
West,screws,60
South,lemon,48
South,apple,71
East,screwdriver,70
East,... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/New-ConditionalFormattingIconSet.tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 2,762 | if (-not (Get-command Import-Excel -ErrorAction SilentlyContinue)) {
Import-Module $PSScriptRoot\..\ImportExcel.psd1
}
Describe "Test New Conditional Formatting IconSet" -Tag ConditionalFormattingIconSet {
BeforeEach {
$xlFilename = "TestDrive:\ConditionalFormattingIconSet.xlsx"
Remove... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/Set-CellComment.tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 2,058 | if (-not (Get-command Import-Excel -ErrorAction SilentlyContinue)) {
Import-Module $PSScriptRoot\..\ImportExcel.psd1
}
Describe "Test setting comment on cells in different ways" -Tag SetCellComment {
BeforeAll {
$data = ConvertFrom-Csv @"
OrderId,Category,Sales,Quantity,Discount
1,Cosmetics,744.01,07,... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/Read-OleDbDataTests/Read-OleDbData.Tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 4,506 | #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 {
... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/Read-OleDbDataTests/Invoke-ExcelQuery.Tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 1,705 | #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 {
... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/ImportExcelTests/Simple.tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 2,620 | [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments','',Justification='False Positives')]
Param()
Import-Module $PSScriptRoot\..\..\ImportExcel.psd1 -Force
Describe "Tests" {
BeforeAll {
$data = $null
$timer = Measure-Command {
$data = Import-Excel... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/ImportExcelTests/ReadMultipleXLSXFiles.tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 1,991 | [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification = 'False Positives')]
Param()
Import-Module $PSScriptRoot\..\..\ImportExcel.psd1 -Force
Describe "Test reading multiple XLSX files of different row count" -Tag ReadMultipleXLSX {
It "Should find these xlsx... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/ImportExcelTests/TestImportOnly.tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 212 | Param()
Describe "Module" -Tag "TestImportOnly" {
It "Should import without error" {
{ Import-Module $PSScriptRoot\..\..\ImportExcel.psd1 -Force -ErrorAction Stop } | Should -Not -Throw
}
} |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/ImportExcelTests/ImportExcelEndRowEndColumn.tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 2,141 | Import-Module $PSScriptRoot\..\..\ImportExcel.psd1 -Force
Describe 'Test' -Tag ImportExcelEndRowAndCols {
BeforeAll {
$script:xlFilename = "$PSScriptRoot\DataInDiffRowCol.xlsx"
}
Context 'Test reading a partial sheet' {
It 'Should read 2 rows and first 3 columns' {
$actual = Im... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/ImportExcelTests/ImportExcelReadSheets.tests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 2,968 | #Requires -Modules Pester
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification = 'False Positives')]
param()
Import-Module $PSScriptRoot\..\..\ImportExcel.psd1 -Force
Describe 'Different ways to import sheets' -Tag ImportExcelReadSheets {
BeforeAll {
... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | __tests__/Samples/Samples.ps1 | PowerShell | apache-2.0 | 2,711 | master | 2,112 | if ($IsLinux -or $IsMacOS) {
if (-not (Get-Command 'Get-Service' -ErrorAction SilentlyContinue)) {
function Get-Service {
Import-Clixml -Path (Join-Path $PSScriptRoot Get-Service.xml)
}
}
if (-not (Get-Command 'Get-CimInstance' -ErrorAction SilentlyContinue)) {
function G... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/TryMultiplePivotTables.ps1 | PowerShell | apache-2.0 | 2,711 | master | 812 | # To ship, is to choose
#ipmo .\ImportExcel.psd1 -Force
$pt=[ordered]@{}
$pt.ServiceInfo=@{
SourceWorkSheet='Services'
PivotRows = "Status"
PivotData= @{'Status'='count'}
IncludePivotChart=$true
ChartType='BarClustered3D'
}
$pt.ProcessInfo=@{
SourceWorkSheet='Processes'
PivotRows = "Com... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/Index - Music.ps1 | PowerShell | apache-2.0 | 2,711 | master | 2,615 | #requires -modules "Get-IndexedItem"
[CmdletBinding()]
Param()
Remove-Item ~\documents\music.xlsx -ErrorAction SilentlyContinue
[System.Diagnostics.Stopwatch]$stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
#Query system index for .MP3 files in C:\Users, where album artist is non-blank. Leave sorted table with... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/TryMultiplePivotTablesFromOneSheet.ps1 | PowerShell | apache-2.0 | 2,711 | master | 1,030 | try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$file = "C:\Temp\test.xlsx"
Remove-Item $file -ErrorAction Ignore -Force
$base = @{
SourceWorkSheet = 'gsv'
PivotData = @{'Status' = 'count'}
IncludePivotChart = $true
# ChartType = 'BarClustered3D'
}
... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/Subtotals.ps1 | PowerShell | apache-2.0 | 2,711 | master | 3,209 | $Data = ConvertFrom-Csv @'
Product, City, Gross, Net
Apple, London , 300, 250
Orange, London , 400, 350
Banana, London , 300, 200
Grape, Munich, 100, 100
Orange, Paris, 600, 500
Banana, Paris, 300, 200
Apple, New York, 1200,700
'@
$ExcelPath = "$env:temp\subtotal.xlsx"
$SheetName ... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/PsGallery.ps1 | PowerShell | apache-2.0 | 2,711 | master | 1,336 | $top1000 = foreach ($p in 1..50) {
$c = Invoke-WebRequest -Uri "https://www.powershellgallery.com/packages" -method Post -Body "q=&sortOrder=package-download-count&page=$p"
[regex]::Matches($c.Content,'<table class="width-hundred-percent">.*?</table>', [System.Text.RegularExpressions.RegexOptions]::Singleline... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/New-PSItem.ps1 | PowerShell | apache-2.0 | 2,711 | master | 598 | function New-PSItem {
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification='Does not change system state')]
param()
$totalArgs = $args.Count
if($args[-1] -is [array]) {
$script:PSItemHeader=$args[-1]
$totalArgs-=1
}
... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/Pester-To-XLSx.ps1 | PowerShell | apache-2.0 | 2,711 | master | 7,046 | [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSPossibleIncorrectComparisonWithNull', '', Justification = 'Intentional use to select non null array items')]
[CmdletBinding(DefaultParameterSetName = 'Default')]
param(
[Parameter(Position = 0)]
[string]$XLFile,
[Parameter(ParameterSetName = 'Default', Posit... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/AddImage/AddImage.ps1 | PowerShell | apache-2.0 | 2,711 | master | 988 | if ($IsWindows -eq $false) {
throw "This only works on Windows and won't run on $([environment]::OSVersion)"
}
Add-Type -AssemblyName System.Drawing
. $PSScriptRoot\Add-ExcelImage.ps1
$data = ConvertFrom-Csv @"
Region,State,Units,Price
West,Texas,927,923.71
North,Tennessee,466,770.67
East,Florida,520,458.68
East... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/AddImage/Add-ExcelImage.ps1 | PowerShell | apache-2.0 | 2,711 | master | 4,516 | function Add-ExcelImage {
<#
.SYNOPSIS
Adds an image to a worksheet in an Excel package.
.DESCRIPTION
Adds an image to a worksheet in an Excel package using the
`WorkSheet.Drawings.AddPicture(name, image)` method, and places the
image at the location specified by the Row and ... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/SpreadsheetCells/HyperLink.ps1 | PowerShell | apache-2.0 | 2,711 | master | 486 | try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
Remove-Item "$env:temp\hyperlink.xlsx" -ErrorAction SilentlyContinue
$(
New-PSItem '=Hyperlink("http://dougfinke.com/blog","Doug Finke")' @("Link")
New-PSItem '=Hyperlink("http://blogs.msdn.com/b/powershell/","PowerShell Blog")'
... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/SpreadsheetCells/CalculatedFields.ps1 | PowerShell | apache-2.0 | 2,711 | master | 519 | try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
#. ..\New-PSItem.ps1
Remove-Item "$env:temp\functions.xlsx" -ErrorAction SilentlyContinue
$(
New-PSItem 12001 Nails 37 3.99 =C2*D2 @("ID", "Product", "Quantity", "Price", "Total")
New-PSItem 12002 Hammer 5 12.10 =C3*D3
Ne... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/SpreadsheetCells/ExcelFormulasUsingAddMember.ps1 | PowerShell | apache-2.0 | 2,711 | master | 447 | try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
Remove-Item .\testFormula.xlsx -ErrorAction Ignore
@"
id,item,units,cost
12001,Nails,37,3.99
12002,Hammer,5,12.10
12003,Saw,12,15.37
12010,Drill,20,8
12011,Crowbar,7,23.48
"@ | ConvertFrom-Csv |
Add-Member -PassThru -MemberType NotePr... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/SpreadsheetCells/ExcelFunctions.ps1 | PowerShell | apache-2.0 | 2,711 | master | 588 | try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
Remove-Item "$env:temp\functions.xlsx" -ErrorAction SilentlyContinue
$(
New-PSItem =2%/12 60 500000 "=pmt(rate,nper,pv)" @("rate", "nper", "pv", "pmt")
New-PSItem =3%/12 60 500000 "=pmt(rate,nper,pv)"
New-PSItem =4%/12 60 5000... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/PassThru/TryPassThru.ps1 | PowerShell | apache-2.0 | 2,711 | master | 942 | try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$file = "$env:Temp\sales.xlsx"
Remove-Item $file -ErrorAction Ignore
#Using -Passthru with Export-Excel returns an Excel Package object.
$xlPkg = Import-Csv .\sales.csv | Export-Excel $file -PassThru
#We add script properties to the pac... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/TestRestAPI/TryIt.ps1 | PowerShell | apache-2.0 | 2,711 | master | 247 | try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
. $PSScriptRoot\TestAPIReadXls.ps1
Test-APIReadXls $PSScriptRoot\testlist.xlsx | Foreach-Object {
Invoke-Pester -Script $_.fullname -PassThru -Show None
} |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/TestRestAPI/TestAPIReadXls.ps1 | PowerShell | apache-2.0 | 2,711 | master | 1,367 | function Test-APIReadXls {
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification="False Positive")]
param(
[parameter(Mandatory)]
$XlFilename,
$WorksheetName = 'Sheet1'
)
$testFileName = "{0}.tests.ps1" -f (Get-date).ToString("yyyyMMddHHmmss"... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/TestRestAPI/ShowPesterResults.ps1 | PowerShell | apache-2.0 | 2,711 | master | 1,522 | function Show-PesterResults {
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification="No suitable singular")]
Param()
$xlfilename = ".\test.xlsx"
Remove-Item $xlfilename -ErrorAction Ignore
$ConditionalText = @()
$ConditionalText += New-ConditionalText -Rang... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/TestRestAPI/PSExcelPester.psm1 | PowerShell | apache-2.0 | 2,711 | master | 2,967 | function ConvertTo-PesterTest {
param(
[parameter(Mandatory)]
$XlFilename,
$WorksheetName = 'Sheet1'
)
$testFileName = "{0}.tests.ps1" -f (Get-date).ToString("yyyyMMddHHmmss")
$records = Import-Excel $XlFilename
$params = @{}
$blocks = $(foreach ($record in $records) ... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/TestRestAPI/RunAndShowUnitTests.ps1 | PowerShell | apache-2.0 | 2,711 | master | 1,283 | try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$xlfilename=".\test.xlsx"
Remove-Item $xlfilename -ErrorAction Ignore
$ConditionalText = @()
$ConditionalText += New-ConditionalText -Range "C:C" -Text failed -BackgroundColor red -ConditionalTextColor black
$ConditionalText += New-Co... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/VBA/AddModuleMultipleWorksheetVBA.ps1 | PowerShell | apache-2.0 | 2,711 | master | 2,078 | $xlfile = "$env:temp\test.xlsm"
Remove-Item $xlfile -ErrorAction SilentlyContinue
ConvertFrom-Csv @"
Region,Item,TotalSold
West,screwdriver,98
West,kiwi,19
North,kiwi,47
West,screws,48
West,avocado,52
East,avocado,40
South,drill,61
North,orange,92
South,drill,29
South,saw,36
"@ | Export-Excel $xlfile -TableName 'Sales... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/VBA/ChangePivotTablesVBA.ps1 | PowerShell | apache-2.0 | 2,711 | master | 2,050 | <#
Excel VBA macro which changes all PivotTables in the workbook to Tabular form, disables subtotals and repeats item labels.
https://github.com/dfinke/ImportExcel/issues/1196#issuecomment-1156320581
#>
$ExcelFile = "$ENV:TEMP\test.xlsm"
Remove-Item -Path $ExcelFile -ErrorAction SilentlyContinue
$Macro = @"
Private Su... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/VBA/HelloWorldVBA.ps1 | PowerShell | apache-2.0 | 2,711 | master | 906 | $xlfile = "$env:temp\test.xlsm"
Remove-Item $xlfile -ErrorAction SilentlyContinue
$Excel = ConvertFrom-Csv @"
Region,Item,TotalSold
West,screwdriver,98
West,kiwi,19
North,kiwi,47
West,screws,48
West,avocado,52
East,avocado,40
South,drill,61
North,orange,92
South,drill,29
South,saw,36
"@ | Export-Excel $xlfile -PassThr... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/VBA/AddWorksheetVBA.ps1 | PowerShell | apache-2.0 | 2,711 | master | 1,524 | $xlfile = "$env:temp\test.xlsm"
Remove-Item $xlfile -ErrorAction SilentlyContinue
$Excel = ConvertFrom-Csv @"
Region,Item,TotalSold
West,screwdriver,98
West,kiwi,19
North,kiwi,47
West,screws,48
West,avocado,52
East,avocado,40
South,drill,61
North,orange,92
South,drill,29
South,saw,36
"@ | Export-Excel $xlfile -TableNa... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/Stocks/GetStocksAvgTotVol.ps1 | PowerShell | apache-2.0 | 2,711 | master | 107 | . $PSScriptRoot\Get-StockInfo.ps1
Get-StockInfo -symbols "msft,ibm,ge,xom,aapl" -dataPlot avgTotalVolume |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/Stocks/Get-StockInfo.ps1 | PowerShell | apache-2.0 | 2,711 | master | 837 | function Get-StockInfo {
param(
[Parameter(Mandatory)]
$symbols,
[ValidateSet('open', 'close', 'high', 'low', 'avgTotalVolume')]
$dataPlot = "close"
)
$xlfile = "$env:TEMP\stocks.xlsx"
Remove-Item -Path $xlfile -ErrorAction Ignore
$result = Invoke-RestMethod "https:... |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/ExcelToSQLInsert/DemoSQLInsert.ps1 | PowerShell | apache-2.0 | 2,711 | master | 319 | try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
ConvertFrom-ExcelToSQLInsert -TableName "Movies" -Path ".\Movies.xlsx" -ConvertEmptyStringsToNull
''
'# UseMSSQLSyntax'
ConvertFrom-ExcelToSQLInsert -UseMSSQLSyntax -TableName "Movies" -Path ".\Movies.xlsx" -ConvertEmptyStringsToNull |
github | dfinke/ImportExcel | https://github.com/dfinke/ImportExcel | Examples/Charts/MultiSeries1.ps1 | PowerShell | apache-2.0 | 2,711 | master | 760 | try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
#Get rid of pre-exisiting sheet
$xlSourcefile = "$env:TEMP\ImportExcelExample.xlsx"
Write-Verbose -Verbose -Message "Save location: $xlSourcefile"
Remove-Item $xlSourcefile -ErrorAction Ignore
$data = @"
A,B,C,Date
2,1,1,2016-03-29
5,10,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.