mirror of
https://github.com/dfinke/ImportExcel.git
synced 2026-01-04 01:23:22 +00:00
Move help from Comment-based to md. Relocate functions (sans help)
This commit is contained in:
26
ExportedCommands/Get-XYRange.ps1
Normal file
26
ExportedCommands/Get-XYRange.ps1
Normal file
@@ -0,0 +1,26 @@
|
||||
function Get-XYRange {
|
||||
param($targetData)
|
||||
|
||||
$record = $targetData | Select-Object -First 1
|
||||
$p=$record.psobject.Properties.name
|
||||
|
||||
$infer = for ($idx = 0; $idx -lt $p.Count; $idx++) {
|
||||
|
||||
$name = $p[$idx]
|
||||
$value = $record.$name
|
||||
|
||||
$result=Invoke-AllTests $value -OnlyPassing -FirstOne
|
||||
|
||||
[PSCustomObject]@{
|
||||
Name = $name
|
||||
Value = $value
|
||||
DataType = $result.DataType
|
||||
ExcelColumn = (Get-ExcelColumnName ($idx+1)).ColumnName
|
||||
}
|
||||
}
|
||||
|
||||
[PSCustomObject]@{
|
||||
XRange = $infer | Where-Object -FilterScript {$_.datatype -match 'string'} | Select-Object -First 1 -Property excelcolumn, name
|
||||
YRange = $infer | Where-Object -FilterScript {$_.datatype -match 'int|double'} | Select-Object -First 1 -Property excelcolumn, name
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user