mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-12 06:13:26 +00:00
Updates to Help text - mostly layout, inc making it VSCode freindly
This commit is contained in:
@@ -32,14 +32,14 @@
|
|||||||
[Parameter(Mandatory = $true, ParameterSetName = "FourIconSet")]
|
[Parameter(Mandatory = $true, ParameterSetName = "FourIconSet")]
|
||||||
[Parameter(Mandatory = $true, ParameterSetName = "FiveIconSet")]
|
[Parameter(Mandatory = $true, ParameterSetName = "FiveIconSet")]
|
||||||
[OfficeOpenXml.ExcelAddress]$Range ,
|
[OfficeOpenXml.ExcelAddress]$Range ,
|
||||||
#One or more row(s), Column(s) and/or block(s) of cells to format
|
#One or more row(s), column(s) and/or block(s) of cells to format
|
||||||
[Parameter(Mandatory = $true, ParameterSetName = "NamedRuleAddress")]
|
[Parameter(Mandatory = $true, ParameterSetName = "NamedRuleAddress")]
|
||||||
[Parameter(Mandatory = $true, ParameterSetName = "DataBarAddress")]
|
[Parameter(Mandatory = $true, ParameterSetName = "DataBarAddress")]
|
||||||
[Parameter(Mandatory = $true, ParameterSetName = "ThreeIconSetAddress")]
|
[Parameter(Mandatory = $true, ParameterSetName = "ThreeIconSetAddress")]
|
||||||
[Parameter(Mandatory = $true, ParameterSetName = "FourIconSetAddress")]
|
[Parameter(Mandatory = $true, ParameterSetName = "FourIconSetAddress")]
|
||||||
[Parameter(Mandatory = $true, ParameterSetName = "FiveIconSetAddress")]
|
[Parameter(Mandatory = $true, ParameterSetName = "FiveIconSetAddress")]
|
||||||
$Address ,
|
$Address ,
|
||||||
#One of the standard named rules - Top / Bottom / Less than / Greater than / Contains etc
|
#One of the standard named rules - Top / Bottom / Less than / Greater than / Contains etc.
|
||||||
[Parameter(Mandatory = $true, ParameterSetName = "NamedRule", Position = 3)]
|
[Parameter(Mandatory = $true, ParameterSetName = "NamedRule", Position = 3)]
|
||||||
[Parameter(Mandatory = $true, ParameterSetName = "NamedRuleAddress", Position = 3)]
|
[Parameter(Mandatory = $true, ParameterSetName = "NamedRuleAddress", Position = 3)]
|
||||||
[OfficeOpenXml.ConditionalFormatting.eExcelConditionalFormattingRuleType]$RuleType ,
|
[OfficeOpenXml.ConditionalFormatting.eExcelConditionalFormattingRuleType]$RuleType ,
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
[OfficeOpenXml.ConditionalFormatting.eExcelconditionalFormatting5IconsSetType]$FiveIconsSet,
|
[OfficeOpenXml.ConditionalFormatting.eExcelconditionalFormatting5IconsSetType]$FiveIconsSet,
|
||||||
#A value for the condition (e.g. "2000" if the test is 'lessthan 2000')
|
#A value for the condition (e.g. "2000" if the test is 'lessthan 2000')
|
||||||
[string]$ConditionValue,
|
[string]$ConditionValue,
|
||||||
#A second value for the conditions like between x and Y
|
#A second value for the conditions like "between x and Y"
|
||||||
[string]$ConditionValue2,
|
[string]$ConditionValue2,
|
||||||
#Background colour for matching items
|
#Background colour for matching items
|
||||||
[System.Drawing.Color]$BackgroundColor,
|
[System.Drawing.Color]$BackgroundColor,
|
||||||
|
|||||||
@@ -2,47 +2,30 @@ function ConvertFrom-ExcelToSQLInsert {
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Generate SQL insert statements from Excel spreadsheet.
|
Generate SQL insert statements from Excel spreadsheet.
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
Generate SQL insert statements from Excel spreadsheet.
|
Generate SQL insert statements from Excel spreadsheet.
|
||||||
|
|
||||||
.PARAMETER TableName
|
.PARAMETER TableName
|
||||||
Name of the target database table.
|
Name of the target database table.
|
||||||
|
|
||||||
.PARAMETER Path
|
.PARAMETER Path
|
||||||
Path to an existing .XLSX file
|
Path to an existing .XLSX file
|
||||||
|
|
||||||
This parameter is passed to Import-Excel as is.
|
This parameter is passed to Import-Excel as is.
|
||||||
|
|
||||||
.PARAMETER WorkSheetname
|
.PARAMETER WorkSheetname
|
||||||
Specifies the name of the worksheet in the Excel workbook to import. By default, if no name is provided, the first worksheet will be imported.
|
Specifies the name of the worksheet in the Excel workbook to import. By default, if no name is provided, the first worksheet will be imported.
|
||||||
|
|
||||||
This parameter is passed to Import-Excel as is.
|
This parameter is passed to Import-Excel as is.
|
||||||
|
|
||||||
.PARAMETER StartRow
|
.PARAMETER StartRow
|
||||||
The row from where we start to import data, all rows above the StartRow are disregarded. By default this is the first row.
|
The row from where we start to import data, all rows above the StartRow are disregarded. By default this is the first row.
|
||||||
|
|
||||||
When the parameters ‘-NoHeader’ and ‘-HeaderName’ are not provided, this row will contain the column headers that will be used as property names. When one of both parameters are provided, the property names are automatically created and this row will be treated as a regular row containing data.
|
When the parameters ‘-NoHeader’ and ‘-HeaderName’ are not provided, this row will contain the column headers that will be used as property names. When one of both parameters are provided, the property names are automatically created and this row will be treated as a regular row containing data.
|
||||||
|
|
||||||
.PARAMETER Header
|
.PARAMETER Header
|
||||||
Specifies custom property names to use, instead of the values defined in the column headers of the TopRow.
|
Specifies custom property names to use, instead of the values defined in the column headers of the TopRow.
|
||||||
|
If you provide fewr header names than there is data in the worksheet, then only the data with a corresponding header name will be imported and the data without header name will be disregarded.
|
||||||
In case you provide less header names than there is data in the worksheet, then only the data with a corresponding header name will be imported and the data without header name will be disregarded.
|
If you provide more header names than there is data in the worksheet, then all data will be imported and all objects will have all the property names you defined in the header names. As such, the last properties will be blank as there is no data for them.
|
||||||
|
|
||||||
In case you provide more header names than there is data in the worksheet, then all data will be imported and all objects will have all the property names you defined in the header names. As such, the last properties will be blanc as there is no data for them.
|
|
||||||
|
|
||||||
.PARAMETER NoHeader
|
.PARAMETER NoHeader
|
||||||
Automatically generate property names (P1, P2, P3, ..) instead of the ones defined in the column headers of the TopRow.
|
Automatically generate property names (P1, P2, P3, ..) instead of the ones defined in the column headers of the TopRow.
|
||||||
|
|
||||||
This switch is best used when you want to import the complete worksheet ‘as is’ and are not concerned with the property names.
|
This switch is best used when you want to import the complete worksheet ‘as is’ and are not concerned with the property names.
|
||||||
|
|
||||||
.PARAMETER DataOnly
|
.PARAMETER DataOnly
|
||||||
Import only rows and columns that contain data, empty rows and empty columns are not imported.
|
Import only rows and columns that contain data, empty rows and empty columns are not imported.
|
||||||
|
|
||||||
|
|
||||||
.PARAMETER ConvertEmptyStringsToNull
|
.PARAMETER ConvertEmptyStringsToNull
|
||||||
If specified, cells without any data are replaced with NULL, instead of an empty string.
|
If specified, cells without any data are replaced with NULL, instead of an empty string.
|
||||||
|
|
||||||
This is to address behviors in certain DBMS where an empty string is insert as 0 for INT column, instead of a NULL value.
|
This is to address behviors in certain DBMS where an empty string is insert as 0 for INT column, instead of a NULL value.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
@@ -85,7 +68,6 @@ function ConvertFrom-ExcelToSQLInsert {
|
|||||||
INSERT INTO Movies ('Movie Name', 'Year', 'Rating') Values('Skyfall', '2012', '9');
|
INSERT INTO Movies ('Movie Name', 'Year', 'Rating') Values('Skyfall', '2012', '9');
|
||||||
INSERT INTO Movies ('Movie Name', 'Year', 'Rating') Values('The Avengers', '2012', NULL);
|
INSERT INTO Movies ('Movie Name', 'Year', 'Rating') Values('The Avengers', '2012', NULL);
|
||||||
|
|
||||||
.NOTES
|
|
||||||
#>
|
#>
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
.Synopsis
|
.Synopsis
|
||||||
Exports the charts in an Excel spreadSheet
|
Exports the charts in an Excel spreadSheet
|
||||||
.Example
|
.Example
|
||||||
Export-Charts .\test,xlsx
|
Export-Charts .\test.xlsx
|
||||||
Exports the charts in test.xlsx to JPEG files in the current directory.
|
Exports the charts in test.xlsx to JPEG files in the current directory.
|
||||||
|
|
||||||
.Example
|
.Example
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
Param (
|
Param (
|
||||||
#Path to the Excel file whose chars we will export.
|
#Path to the Excel file whose chars we will export.
|
||||||
$Path = "C:\Users\public\Documents\stats.xlsx",
|
$Path = "C:\Users\public\Documents\stats.xlsx",
|
||||||
#If specified, output file objects representing the image files.
|
#If specified, output file objects representing the image files
|
||||||
[switch]$Passthru,
|
[switch]$Passthru,
|
||||||
#Format to write - JPG by default
|
#Format to write - JPG by default
|
||||||
[ValidateSet("JPG","PNG","GIF")]
|
[ValidateSet("JPG","PNG","GIF")]
|
||||||
|
|||||||
@@ -2,13 +2,10 @@ Function Get-ExcelSheetInfo {
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Get worksheet names and their indices of an Excel workbook.
|
Get worksheet names and their indices of an Excel workbook.
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
The Get-ExcelSheetInfo cmdlet gets worksheet names and their indices of an Excel workbook.
|
The Get-ExcelSheetInfo cmdlet gets worksheet names and their indices of an Excel workbook.
|
||||||
|
|
||||||
.PARAMETER Path
|
.PARAMETER Path
|
||||||
Specifies the path to the Excel file. This parameter is required.
|
Specifies the path to the Excel file. This parameter is required.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-ExcelSheetInfo .\Test.xlsx
|
Get-ExcelSheetInfo .\Test.xlsx
|
||||||
|
|
||||||
@@ -18,7 +15,6 @@ Function Get-ExcelSheetInfo {
|
|||||||
|
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/dfinke/ImportExcel
|
https://github.com/dfinke/ImportExcel
|
||||||
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
|
|||||||
@@ -2,13 +2,10 @@
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Retrieve information of an Excel workbook.
|
Retrieve information of an Excel workbook.
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
The Get-ExcelWorkbookInfo cmdlet retrieves information (LastModifiedBy, LastPrinted, Created, Modified, ...) fron an Excel workbook. These are the same details that are visible in Windows Explorer when right clicking the Excel file, selecting Properties and check the Details tabpage.
|
The Get-ExcelWorkbookInfo cmdlet retrieves information (LastModifiedBy, LastPrinted, Created, Modified, ...) fron an Excel workbook. These are the same details that are visible in Windows Explorer when right clicking the Excel file, selecting Properties and check the Details tabpage.
|
||||||
|
|
||||||
.PARAMETER Path
|
.PARAMETER Path
|
||||||
Specifies the path to the Excel file. This parameter is required.
|
Specifies the path to the Excel file. This parameter is required.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-ExcelWorkbookInfo .\Test.xlsx
|
Get-ExcelWorkbookInfo .\Test.xlsx
|
||||||
|
|
||||||
|
|||||||
@@ -11,21 +11,22 @@
|
|||||||
C:> Set-Column -Worksheet $ws -Heading "WinsToFastLaps" -Value {"=E$row/C$row"} -Column 7 -AutoSize -AutoNameRange
|
C:> Set-Column -Worksheet $ws -Heading "WinsToFastLaps" -Value {"=E$row/C$row"} -Column 7 -AutoSize -AutoNameRange
|
||||||
Here $WS already contains a worksheet which contains counts of races won and fastest laps recorded by racing drivers (in columns C and E)
|
Here $WS already contains a worksheet which contains counts of races won and fastest laps recorded by racing drivers (in columns C and E)
|
||||||
Set-Column specifies that Column 7 should have a heading of "WinsToFastLaps" and the data cells should contain =E2/C2 , =E3/C3
|
Set-Column specifies that Column 7 should have a heading of "WinsToFastLaps" and the data cells should contain =E2/C2 , =E3/C3
|
||||||
the data celss should become a named range, which will also be "WinsToFastLaps" the column width will be set automatically
|
the data cells should become a named range, which will also be "WinsToFastLaps" the column width will be set automatically
|
||||||
|
|
||||||
#>
|
#>
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
Param (
|
Param (
|
||||||
[Parameter(ParameterSetName="Package",Mandatory=$true)]
|
[Parameter(ParameterSetName="Package",Mandatory=$true)]
|
||||||
[OfficeOpenXml.ExcelPackage]$ExcelPackage,
|
[OfficeOpenXml.ExcelPackage]$ExcelPackage,
|
||||||
#Sheet to update
|
#The sheet to update can be a given as a name or an Excel Worksheet object - this sets it by name
|
||||||
[Parameter(ParameterSetName="Package")]
|
[Parameter(ParameterSetName="Package")]
|
||||||
|
#The sheet to update can be a given as a name or an Excel Worksheet object - $workSheet contains the object
|
||||||
$Worksheetname = "Sheet1",
|
$Worksheetname = "Sheet1",
|
||||||
[Parameter(ParameterSetName="sheet",Mandatory=$true)]
|
[Parameter(ParameterSetName="sheet",Mandatory=$true)]
|
||||||
[OfficeOpenXml.ExcelWorksheet]
|
[OfficeOpenXml.ExcelWorksheet]
|
||||||
$Worksheet,
|
$Worksheet,
|
||||||
#Column to fill down - first column is 1. 0 will be interpreted as first unused column
|
#Column to fill down - first column is 1. 0 will be interpreted as first unused column
|
||||||
$Column = 0 ,
|
$Column = 0 ,
|
||||||
|
#First row to fill data in
|
||||||
[Int]$StartRow ,
|
[Int]$StartRow ,
|
||||||
#value, formula or script block for to fill in. Script block can use $row, $column [number], $ColumnName [letter(s)], $startRow, $startColumn, $endRow, $endColumn
|
#value, formula or script block for to fill in. Script block can use $row, $column [number], $ColumnName [letter(s)], $startRow, $startColumn, $endRow, $endColumn
|
||||||
[parameter(Mandatory=$true)]
|
[parameter(Mandatory=$true)]
|
||||||
@@ -76,8 +77,9 @@
|
|||||||
[Switch]$AutoSize,
|
[Switch]$AutoSize,
|
||||||
#Set cells to a fixed width, ignored if Autosize is specified
|
#Set cells to a fixed width, ignored if Autosize is specified
|
||||||
[float]$Width,
|
[float]$Width,
|
||||||
#Set the inserted data to be a named range (ignored if header is not specified) d
|
#Set the inserted data to be a named range (ignored if header is not specified)
|
||||||
[Switch]$AutoNameRange,
|
[Switch]$AutoNameRange,
|
||||||
|
#If Specified, return an ExcelPackage object to allow further work to be done on the file.
|
||||||
[switch]$PassThru
|
[switch]$PassThru
|
||||||
)
|
)
|
||||||
#if we were passed a package object and a worksheet name , get the worksheet.
|
#if we were passed a package object and a worksheet name , get the worksheet.
|
||||||
|
|||||||
@@ -15,8 +15,6 @@
|
|||||||
=Sum(xx2:xx99) - where xx is the column name, and 99 is the last row of data.
|
=Sum(xx2:xx99) - where xx is the column name, and 99 is the last row of data.
|
||||||
Note the use of `2 to Prevent 2 becoming part of the variable "ColumnName"
|
Note the use of `2 to Prevent 2 becoming part of the variable "ColumnName"
|
||||||
The script block can use $row, $column, $ColumnName, $startRow/Column $endRow/Column
|
The script block can use $row, $column, $ColumnName, $startRow/Column $endRow/Column
|
||||||
|
|
||||||
|
|
||||||
#>
|
#>
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
Param (
|
Param (
|
||||||
@@ -75,11 +73,12 @@
|
|||||||
[OfficeOpenXml.Style.ExcelHorizontalAlignment]$HorizontalAlignment,
|
[OfficeOpenXml.Style.ExcelHorizontalAlignment]$HorizontalAlignment,
|
||||||
#Position cell contents to top bottom or centre
|
#Position cell contents to top bottom or centre
|
||||||
[OfficeOpenXml.Style.ExcelVerticalAlignment]$VerticalAlignment,
|
[OfficeOpenXml.Style.ExcelVerticalAlignment]$VerticalAlignment,
|
||||||
#Degrees to rotate text. Up to +90 for anti-clockwise ("upwards"), or to -90 for clockwise.
|
#Degrees to rotate text. Up to +90 for anti-clockwise ("upwards"), or to -90 for clockwise
|
||||||
[ValidateRange(-90, 90)]
|
[ValidateRange(-90, 90)]
|
||||||
[int]$TextRotation ,
|
[int]$TextRotation ,
|
||||||
#Set cells to a fixed hieght
|
#Set cells to a fixed hieght
|
||||||
[float]$Height,
|
[float]$Height,
|
||||||
|
#If Specified, return an ExcelPackage object to allow further work to be done on the file
|
||||||
[switch]$PassThru
|
[switch]$PassThru
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,8 @@ Function Update-FirstObjectProperties {
|
|||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
2017/06/08 Function born #>
|
2017/06/08 Function born
|
||||||
|
#>
|
||||||
|
|
||||||
Try {
|
Try {
|
||||||
$Union = @()
|
$Union = @()
|
||||||
|
|||||||
Reference in New Issue
Block a user