mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-16 00:04:24 +00:00
Move help from Comment-based to md. Relocate functions (sans help)
This commit is contained in:
29
ExportedCommands/ConvertFrom-ExcelData.ps1
Normal file
29
ExportedCommands/ConvertFrom-ExcelData.ps1
Normal file
@@ -0,0 +1,29 @@
|
||||
function ConvertFrom-ExcelData {
|
||||
[alias("Use-ExcelData")]
|
||||
param(
|
||||
[Alias("FullName")]
|
||||
[Parameter(ValueFromPipelineByPropertyName = $true, ValueFromPipeline = $true, Mandatory = $true)]
|
||||
[ValidateScript( { Test-Path $_ -PathType Leaf })]
|
||||
$Path,
|
||||
[ScriptBlock]$scriptBlock,
|
||||
[Alias("Sheet")]
|
||||
$WorkSheetname = 1,
|
||||
[int]$HeaderRow = 1,
|
||||
[string[]]$Header,
|
||||
[switch]$NoHeader,
|
||||
[switch]$DataOnly
|
||||
)
|
||||
|
||||
$null = $PSBoundParameters.Remove('scriptBlock')
|
||||
$params = @{} + $PSBoundParameters
|
||||
|
||||
$data = Import-Excel @params
|
||||
|
||||
$PropertyNames = $data[0].psobject.Properties |
|
||||
Where-Object {$_.membertype -match 'property'} |
|
||||
Select-Object -ExpandProperty name
|
||||
|
||||
foreach ($record in $data) {
|
||||
& $scriptBlock $PropertyNames $record
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user