Add -AsDate support to import-Excel and ConvertFrom-Excel sheet. Help upate

This commit is contained in:
jhoneill
2019-12-22 17:53:05 +00:00
parent 118330ea47
commit 97611fc57c
8 changed files with 492 additions and 153 deletions

View File

@@ -1,140 +0,0 @@
---
external help file: ImportExcel-help.xml
Module Name: ImportExcel
online version:
schema: 2.0.0
---
# ConvertFrom-ExcelSheet
## SYNOPSIS
Reads an Excel file an converts the data to a delimited text file.
## SYNTAX
```
ConvertFrom-ExcelSheet [-Path] <String> [[-OutputPath] <String>] [[-SheetName] <String>] [[-Encoding] <String>]
[[-Extension] <String>] [[-Delimiter] <String>] [<CommonParameters>]
```
## DESCRIPTION
{{ Fill in the Description }}
## EXAMPLES
### EXAMPLE 1
```
ConvertFrom-ExcelSheet .\TestSheets.xlsx .\data
```
Reads each sheet in TestSheets.xlsx and outputs it to the data directory as the sheet name with the extension .txt.
### EXAMPLE 2
```
ConvertFrom-ExcelSheet .\TestSheets.xlsx .\data sheet?0
```
Reads and outputs sheets like Sheet10 and Sheet20 form TestSheets.xlsx and outputs it to the data directory as the sheet name with the extension .txt.
## PARAMETERS
### -Path
{{ Fill Path Description }}
```yaml
Type: String
Parameter Sets: (All)
Aliases: FullName
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -OutputPath
{{ Fill OutputPath Description }}
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: .\
Accept pipeline input: False
Accept wildcard characters: False
```
### -SheetName
{{ Fill SheetName Description }}
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: *
Accept pipeline input: False
Accept wildcard characters: False
```
### -Encoding
{{ Fill Encoding Description }}
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: UTF8
Accept pipeline input: False
Accept wildcard characters: False
```
### -Extension
{{ Fill Extension Description }}
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: .csv
Accept pipeline input: False
Accept wildcard characters: False
```
### -Delimiter
{{ Fill Delimiter Description }}
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 6
Default value: ;
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

@@ -15,7 +15,8 @@ function ConvertFrom-ExcelSheet {
$Property = "*",
$ExcludeProperty = @(),
[switch]$Append,
[string[]]$AsText = @()
[string[]]$AsText = @(),
[string[]]$AsDate = @()
)
$Path = (Resolve-Path $Path).Path
@@ -25,7 +26,7 @@ function ConvertFrom-ExcelSheet {
$targetSheets = $workbook.Worksheets | Where-Object {$_.Name -Like $SheetName}
$csvParams = @{NoTypeInformation = $true} + $PSBoundParameters
foreach ($p in 'OutputPath', 'SheetName', 'Extension', 'Property','ExcludeProperty', 'AsText') {
foreach ($p in 'OutputPath', 'SheetName', 'Extension', 'Property','ExcludeProperty', 'AsText','AsDate') {
$csvParams.Remove($p)
}
@@ -34,7 +35,7 @@ function ConvertFrom-ExcelSheet {
$csvParams.Path = "$OutputPath\$($Sheet.Name)$Extension"
Import-Excel -ExcelPackage $xl -Sheet $($sheet.Name) -AsText:$AsText |
Import-Excel -ExcelPackage $xl -Sheet $($sheet.Name) -AsText:$AsText -AsDate:$AsDate |
Select-Object -Property $Property | Export-Csv @csvparams
}

View File

@@ -33,6 +33,7 @@
[Int]$EndColumn ,
[Switch]$DataOnly,
[string[]]$AsText,
[string[]]$AsDate,
[ValidateNotNullOrEmpty()]
[String]$Password
)
@@ -160,24 +161,38 @@
}
else {
#region Create one object per row
if ($AsText) {
if ($AsText -or $AsDate) {
<#join items in AsText together with ~~~ . Escape any regex special characters...
# which turns "*" into "\*" make it ".*". Convert ~~~ to $|^ and top and tail with ^%;
So if we get "Week", "[Time]" and "*date*" ; make the expression ^week$|^\[Time\]$|^.*Date.*$
$make a regex for this which is case insensitive (option 1) and compiled (option 8)
#>
$TextColExpression = "^" + [regex]::Escape($AsText -join "~~~").replace("\*", ".*").replace("~~~", "$|^") + "$"
$TextColExpression = ''
if ($AsText) {
$TextColExpression += '(?<astext>^' + [regex]::Escape($AsText -join '~~~').replace('\*', '.*').replace('~~~', '$|^') + '$)'
}
if ($AsText -and $AsDate) {
$TextColExpression += "|"
}
if ($AsDate) {
$TextColExpression += '(?<asDate>^' + [regex]::Escape($AsDate -join '~~~').replace('\*', '.*').replace('~~~', '$|^') + '$)'
}
$TextColRegEx = New-Object -TypeName regex -ArgumentList $TextColExpression , 9
}
else {$TextColRegEx = $null}
foreach ($R in $Rows) {
#Disabled write-verbose for speed
# Write-Verbose "Import row '$R'"
$NewRow = [Ordered]@{ }
if ($TextColRegEx) {
foreach ($P in $PropertyNames) {
if ($TextColRegEx.IsMatch($P.Value)) {
$MatchTest = $TextColRegEx.Match($P.value)
if ($MatchTest.groups.name -eq "astext") {
$NewRow[$P.Value] = $Worksheet.Cells[$R, $P.Column].Text
}
elseif ($MatchTest.groups.name -eq "asdate" -and $Worksheet.Cells[$R, $P.Column].Value -is [System.ValueType]) {
$NewRow[$P.Value] = [datetime]::FromOADate(($Worksheet.Cells[$R, $P.Column].Value))
}
else { $NewRow[$P.Value] = $Worksheet.Cells[$R, $P.Column].Value }
}
}

View File

@@ -12,25 +12,30 @@ Describe 'ConvertFrom-ExcelSheet / Export-ExcelSheet' {
ConvertFrom-ExcelSheet -Path $dataPath -OutputPath $Outpath -AsText "GridPosition" -Property driver,
@{n="date"; e={[datetime]::FromOADate($_.Date).tostring("#MM/dd/yyyy#")}} , FinishPosition, GridPosition
$ThirdText = Get-Content (Join-path -Path $Outpath -ChildPath "First10Races.csv")
ConvertFrom-ExcelSheet -Path $dataPath -OutputPath $Outpath -AsDate "date"
$FourthText = Get-Content (Join-path -Path $Outpath -ChildPath "First10Races.csv")
}
Context "Exporting to CSV" {
it "Exported the expected columns to a CSV file " {
$firstText[0] | should be '"Race","Date","FinishPosition","Driver","GridPosition","Team","Points"'
$SecondText[0] | should be '"Race","Date","FinishPosition","Driver","GridPosition","Team","Points"'
$ThirdText[0] | should be '"Driver","date","FinishPosition","GridPosition"'
$FourthText[0] | should be '"Race","Date","FinishPosition","Driver","GridPosition","Team","Points"'
}
it "Applied ASText and Properties correctly " {
it "Applied AsText, AsDate and Properties correctly " {
$firstText[1] | should match '^"\w+","\d{5}","\d{1,2}","\w+ \w+","[1-9]\d?","\w+","\d{1,2}"$'
$date = $firstText[1] -replace '^.*(\d{5}).*$', '$1'
$date = [datetime]::FromOADate($date).toString("D")
$secondText[1] | should belike "*$date*"
$secondText[1] | should match '"0\d","\w+","\d{1,2}"$'
$ThirdText[1] | should match '^"\w+ \w+","#\d\d/\d\d/\d{4}#","\d","0\d"$'
$FourthText[1] | should match '^"\w+","[012]\d'
}
}
Context "Export aliased to ConvertFrom" {
it "Applied ASText and Properties correctly " {
it "Definded the alias name with " {
(Get-Alias Export-ExcelSheet).source | should be "ImportExcel"
(Get-Alias Export-ExcelSheet).Definition | should be "ConvertFrom-ExcelSheet"
}
}
}

View File

@@ -6576,6 +6576,346 @@ Boston,2/18/2018,1000
<command:examples />
<command:relatedLinks />
</command:command>
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
<command:details>
<command:name>ConvertFrom-ExcelSheet</command:name>
<command:verb>ConvertFrom</command:verb>
<command:noun>ExcelSheet</command:noun>
<maml:description>
<maml:para>Exports Sheets from Excel Workbooks to CSV files.</maml:para>
</maml:description>
</command:details>
<maml:description>
<maml:para>This command provides a convenient way to run Import-Excel @ImportParameters | Select-Object @selectParameters | export-Csv @ ExportParameters It can take the parameters -AsText , as used in Import-Excel, )Properties &amp; -ExcludeProperties as used in Select-Object and -Append, -Delimiter and -Encoding as used in Export-CSV</maml:para>
</maml:description>
<command:syntax>
<command:syntaxItem>
<maml:name>ConvertFrom-ExcelSheet</maml:name>
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none">
<maml:name>Path</maml:name>
<maml:Description>
<maml:para>The path to the .XLSX file which will be exported.</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
<maml:name>String</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none">
<maml:name>OutputPath</maml:name>
<maml:Description>
<maml:para>The directory where the output file(s) will be created. The file name(s) will match the name of the workbook page which contained the data.</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
<maml:name>String</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none">
<maml:name>SheetName</maml:name>
<maml:Description>
<maml:para>The name of a sheet to export, or a regular expression which is used to identify sheets</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
<maml:name>String</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="3" aliases="none">
<maml:name>Encoding</maml:name>
<maml:Description>
<maml:para>Sets the text encoding for the output data file; UTF8 bu default</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">Encoding</command:parameterValue>
<dev:type>
<maml:name>Encoding</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="4" aliases="none">
<maml:name>Extension</maml:name>
<maml:Description>
<maml:para>Sets the file extension for the exported data, defaults to CSV</maml:para>
</maml:Description>
<command:parameterValueGroup>
<command:parameterValue required="false" command:variableLength="false">.txt</command:parameterValue>
<command:parameterValue required="false" command:variableLength="false">.log</command:parameterValue>
<command:parameterValue required="false" command:variableLength="false">.csv</command:parameterValue>
</command:parameterValueGroup>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
<maml:name>String</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="5" aliases="none">
<maml:name>Delimiter</maml:name>
<maml:Description>
<maml:para>Selects , or ; as the delimeter for the exported data - if not specified , is used by default.</maml:para>
</maml:Description>
<command:parameterValueGroup>
<command:parameterValue required="false" command:variableLength="false">;</command:parameterValue>
<command:parameterValue required="false" command:variableLength="false"></command:parameterValue>
<command:parameterValue required="false" command:variableLength="false"></command:parameterValue>
</command:parameterValueGroup>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
<maml:name>String</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="6" aliases="none">
<maml:name>Property</maml:name>
<maml:Description>
<maml:para>Specifies the properties to select. Wildcards are permitted - the default is "*". The value of the Property parameter can be a new calculated property, and follows the same pattern as Select-Item</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">Object</command:parameterValue>
<dev:type>
<maml:name>Object</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="7" aliases="none">
<maml:name>ExcludeProperty</maml:name>
<maml:Description>
<maml:para>Specifies the properties that to exclude from the export. Wildcards are permitted. This parameter is effective only when the command also includes the Property parameter.</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">Object</command:parameterValue>
<dev:type>
<maml:name>Object</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="8" aliases="none">
<maml:name>AsText</maml:name>
<maml:Description>
<maml:para>AsText allows selected columns to be returned as the text displayed in their cells, instead of their value. (* is supported as a wildcard.)</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String[]</command:parameterValue>
<dev:type>
<maml:name>String[]</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="8" aliases="none">
<maml:name>AsDate</maml:name>
<maml:Description>
<maml:para>Not all date formats are recognized as indicating the number in the cell represents a date AsDate forces the number which would be returned to be converted to a date. (* is supported as a wildcard.)</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String[]</command:parameterValue>
<dev:type>
<maml:name>String[]</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>Append</maml:name>
<maml:Description>
<maml:para>Use this parameter to have the export add output to the end of the file. Without this parameter, the command replaces the file contents without warning.</maml:para>
</maml:Description>
<dev:type>
<maml:name>SwitchParameter</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>False</dev:defaultValue>
</command:parameter>
</command:syntaxItem>
</command:syntax>
<command:parameters>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>Append</maml:name>
<maml:Description>
<maml:para>Use this parameter to have the export add output to the end of the file. Without this parameter, the command replaces the file contents without warning.</maml:para>
</maml:Description>
<command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
<dev:type>
<maml:name>SwitchParameter</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>False</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="8" aliases="none">
<maml:name>AsText</maml:name>
<maml:Description>
<maml:para>AsText allows selected columns to be returned as the text displayed in their cells, instead of their value. (* is supported as a wildcard.)</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String[]</command:parameterValue>
<dev:type>
<maml:name>String[]</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="8" aliases="none">
<maml:name>AsDate</maml:name>
<maml:Description>
<maml:para>Not all date formats are recognized as indicating the number in the cell represents a date AsDate forces the number which would be returned to be converted to a date. (* is supported as a wildcard.)</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String[]</command:parameterValue>
<dev:type>
<maml:name>String[]</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="5" aliases="none">
<maml:name>Delimiter</maml:name>
<maml:Description>
<maml:para>Selects , or ; as the delimeter for the exported data - if not specified , is used by default.</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
<maml:name>String</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="3" aliases="none">
<maml:name>Encoding</maml:name>
<maml:Description>
<maml:para>Sets the text encoding for the output data file; UTF8 bu default</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">Encoding</command:parameterValue>
<dev:type>
<maml:name>Encoding</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="7" aliases="none">
<maml:name>ExcludeProperty</maml:name>
<maml:Description>
<maml:para>Specifies the properties that to exclude from the export. Wildcards are permitted. This parameter is effective only when the command also includes the Property parameter.</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">Object</command:parameterValue>
<dev:type>
<maml:name>Object</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="4" aliases="none">
<maml:name>Extension</maml:name>
<maml:Description>
<maml:para>Sets the file extension for the exported data, defaults to CSV</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
<maml:name>String</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none">
<maml:name>OutputPath</maml:name>
<maml:Description>
<maml:para>The directory where the output file(s) will be created. The file name(s) will match the name of the workbook page which contained the data.</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
<maml:name>String</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none">
<maml:name>Path</maml:name>
<maml:Description>
<maml:para>The path to the .XLSX file which will be exported.</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
<maml:name>String</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="6" aliases="none">
<maml:name>Property</maml:name>
<maml:Description>
<maml:para>Specifies the properties to select. Wildcards are permitted - the default is "*". The value of the Property parameter can be a new calculated property, and follows the same pattern as Select-Item</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">Object</command:parameterValue>
<dev:type>
<maml:name>Object</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none">
<maml:name>SheetName</maml:name>
<maml:Description>
<maml:para>The name of a sheet to export, or a regular expression which is used to identify sheets</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
<maml:name>String</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
</command:parameters>
<command:inputTypes>
<command:inputType>
<dev:type>
<maml:name>None</maml:name>
</dev:type>
<maml:description>
<maml:para></maml:para>
</maml:description>
</command:inputType>
</command:inputTypes>
<command:returnValues>
<command:returnValue>
<dev:type>
<maml:name>System.Object</maml:name>
</dev:type>
<maml:description>
<maml:para></maml:para>
</maml:description>
</command:returnValue>
</command:returnValues>
<maml:alertSet>
<maml:alert>
<maml:para></maml:para>
</maml:alert>
</maml:alertSet>
<command:examples>
<command:example>
<maml:title>-------------------------- Example 1 --------------------------</maml:title>
<dev:code>PS C:\&gt; ConvertFrom-ExcelSheet Path .\__tests__\First10Races.xlsx -OutputPath .. -AsText GridPosition,date</dev:code>
<dev:remarks>
<maml:para>First10Races.xlsx contains information about Motor races. The race date and grid (starting) position are stored with custom formats. The command specifies the path to the file, and the directory to create the output file, and specifies that the columns "GridPosition" and "Date" should be treated as text to preserve their formatting</maml:para>
</dev:remarks>
</command:example>
<command:example>
<maml:title>-------------------------- Example 2 --------------------------</maml:title>
<dev:code>PS C:\&gt; ConvertFrom-ExcelSheet Path .\__tests__\First10Races.xlsx -OutputPath .. -AsText "GridPosition" -Property driver, @{n="date"; e={[datetime]::FromOADate($_.Date).tostring("#MM/dd/yyyy#")}} , FinishPosition, GridPosition</dev:code>
<dev:remarks>
<maml:para>This uses the same file as example 1. Because the race date has a custom format, it imports as a number, The requirement is to create a CSV file with the Driver, a specially formatted Date, FinishPostion and GridPostion (keeping its custom formatting). The command specifies the path to the file, and the directory to create the output file, specifies that the column "GridPosition" should be treated as text instead of a number, and the output properties should be Driver, a calculated "date" field, FinishPosition and GridPsition. FromOADate converts the dates used by Excel (Days since Jan 1 1900) to a datetime object.</maml:para>
</dev:remarks>
</command:example>
</command:examples>
<command:relatedLinks>
<maml:navigationLink>
<maml:linkText>Online Version:</maml:linkText>
<maml:uri>https://github.com/dfinke/ImportExcel</maml:uri>
</maml:navigationLink>
</command:relatedLinks>
</command:command>
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
<command:details>
<command:name>ConvertFrom-ExcelToSQLInsert</command:name>
@@ -10499,6 +10839,18 @@ PS\&gt; Export-Excel -ExcelPackage $excel -WorksheetName "Processes" -IncludePiv
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>AsDate</maml:name>
<maml:Description>
<maml:para>Not all date formats are recognized as indicating the number in the cell represents a date AsDate forces the number which would be returned to be converted to a date. (* is supported as a wildcard.)</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String[]</command:parameterValue>
<dev:type>
<maml:name>String[]</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>Password</maml:name>
<maml:Description>
@@ -10624,6 +10976,18 @@ PS\&gt; Export-Excel -ExcelPackage $excel -WorksheetName "Processes" -IncludePiv
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>AsDate</maml:name>
<maml:Description>
<maml:para>Not all date formats are recognized as indicating the number in the cell represents a date AsDate forces the number which would be returned to be converted to a date. (* is supported as a wildcard.)</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String[]</command:parameterValue>
<dev:type>
<maml:name>String[]</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>Password</maml:name>
<maml:Description>
@@ -10735,6 +11099,18 @@ PS\&gt; Export-Excel -ExcelPackage $excel -WorksheetName "Processes" -IncludePiv
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>AsDate</maml:name>
<maml:Description>
<maml:para>Not all date formats are recognized as indicating the number in the cell represents a date AsDate forces the number which would be returned to be converted to a date. (* is supported as a wildcard.)</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String[]</command:parameterValue>
<dev:type>
<maml:name>String[]</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>Password</maml:name>
<maml:Description>
@@ -10859,6 +11235,18 @@ PS\&gt; Export-Excel -ExcelPackage $excel -WorksheetName "Processes" -IncludePiv
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>AsDate</maml:name>
<maml:Description>
<maml:para>Not all date formats are recognized as indicating the number in the cell represents a date AsDate forces the number which would be returned to be converted to a date. (* is supported as a wildcard.)</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String[]</command:parameterValue>
<dev:type>
<maml:name>String[]</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>Password</maml:name>
<maml:Description>
@@ -10985,6 +11373,18 @@ PS\&gt; Export-Excel -ExcelPackage $excel -WorksheetName "Processes" -IncludePiv
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>AsDate</maml:name>
<maml:Description>
<maml:para>Not all date formats are recognized as indicating the number in the cell represents a date AsDate forces the number which would be returned to be converted to a date. (* is supported as a wildcard.)</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String[]</command:parameterValue>
<dev:type>
<maml:name>String[]</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>Password</maml:name>
<maml:Description>
@@ -11097,6 +11497,18 @@ PS\&gt; Export-Excel -ExcelPackage $excel -WorksheetName "Processes" -IncludePiv
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>AsDate</maml:name>
<maml:Description>
<maml:para>Not all date formats are recognized as indicating the number in the cell represents a date AsDate forces the number which would be returned to be converted to a date. (* is supported as a wildcard.)</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String[]</command:parameterValue>
<dev:type>
<maml:name>String[]</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>Password</maml:name>
<maml:Description>
@@ -11249,6 +11661,18 @@ PS\&gt; Export-Excel -ExcelPackage $excel -WorksheetName "Processes" -IncludePiv
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>AsDate</maml:name>
<maml:Description>
<maml:para>Not all date formats are recognized as indicating the number in the cell represents a date AsDate forces the number which would be returned to be converted to a date. (* is supported as a wildcard.)</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">String[]</command:parameterValue>
<dev:type>
<maml:name>String[]</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>Password</maml:name>
<maml:Description>

4
mdHelp/buildHelp.ps1 Normal file
View File

@@ -0,0 +1,4 @@
Import-Module platyPS
Get-ChildItem $PSScriptRoot -Directory | ForEach-Object {
New-ExternalHelp -Path $_.FullName -OutputPath (Join-Path $PSScriptRoot "..\$($_.Name)") -Force -Verbose
}

View File

@@ -76,6 +76,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -AsDate
Not all date formats are recognized as indicating the number in the cell represents a date AsDate forces the number which would be returned to be converted to a date. (* is supported as a wildcard.)
```yaml
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 8
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Delimiter
Selects , or ; as the delimeter for the exported data - if not specified , is used by default.

View File

@@ -395,6 +395,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -AsDate
Not all date formats are recognized as indicating the number in the cell represents a date AsDate forces the number which would be returned to be converted to a date. (* is supported as a wildcard.)
```yaml
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Password
Accepts a string that will be used to open a password protected Excel file.