mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-10 21:33:16 +00:00
@@ -1339,6 +1339,14 @@ function Add-ExcelTable {
|
|||||||
[Switch]$PassThru
|
[Switch]$PassThru
|
||||||
)
|
)
|
||||||
try {
|
try {
|
||||||
|
if ([OfficeOpenXml.FormulaParsing.ExcelUtilities.ExcelAddressUtil]::IsValidAddress($TableName)) {
|
||||||
|
Write-Warning -Message "$tableName reads as an Excel address, and so is not allowed as a table name."
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if ($tableName -notMatch '^[A-Z]') {
|
||||||
|
Write-Warning -Message "$tableName is not allowed as a table name because it does not begin with a letter."
|
||||||
|
return
|
||||||
|
}
|
||||||
if ($TableName -match "\W") {
|
if ($TableName -match "\W") {
|
||||||
Write-Warning -Message "At least one character in $TableName is illegal in a table name and will be replaced with '_' . "
|
Write-Warning -Message "At least one character in $TableName is illegal in a table name and will be replaced with '_' . "
|
||||||
$TableName = $TableName -replace '\W', '_'
|
$TableName = $TableName -replace '\W', '_'
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ function New-ConditionalText {
|
|||||||
|
|
||||||
This builds on the previous example, and specifies a condition of <=3 with
|
This builds on the previous example, and specifies a condition of <=3 with
|
||||||
a format of red text on a white background; this applies to a named range
|
a format of red text on a white background; this applies to a named range
|
||||||
"Finish Position". The range could be written "C:C" to specify a named
|
"Finish Position". The range could be written -Range "C:C" to specify a
|
||||||
column, or "C2:C102" to specify certain cells in the column.
|
named column, or -Range "C2:C102" to specify certain cells in the column.
|
||||||
.Link
|
.Link
|
||||||
Add-Add-ConditionalFormatting
|
Add-Add-ConditionalFormatting
|
||||||
New-ConditionalFormattingIconSet
|
New-ConditionalFormattingIconSet
|
||||||
|
|||||||
@@ -53,6 +53,9 @@ Install-Module ImportExcel -scope CurrentUser
|
|||||||
Install-Module ImportExcel
|
Install-Module ImportExcel
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# What's new
|
||||||
|
- Set-ExcelRow and Set-ExcelColumn now check that the worksheet name they passed exists in the workbook.
|
||||||
|
|
||||||
# What's new 5.4
|
# What's new 5.4
|
||||||
|
|
||||||
- Thank you to Conrad Agramont, Twitter: [@AGramont](https://twitter.com/@AGramont) for the `AddMultiWorkSheet.ps1` example. Much appreciated!
|
- Thank you to Conrad Agramont, Twitter: [@AGramont](https://twitter.com/@AGramont) for the `AddMultiWorkSheet.ps1` example. Much appreciated!
|
||||||
|
|||||||
@@ -121,7 +121,12 @@
|
|||||||
|
|
||||||
begin {
|
begin {
|
||||||
#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.
|
||||||
if ($ExcelPackage) {$Worksheet = $ExcelPackage.Workbook.Worksheets[$Worksheetname] }
|
if ($ExcelPackage) {
|
||||||
|
if ($ExcelPackage.Workbook.Worksheets.Name -notcontains $Worksheetname) {
|
||||||
|
throw "The Workbook does not contain a sheet named '$Worksheetname'"
|
||||||
|
}
|
||||||
|
else {$Worksheet = $ExcelPackage.Workbook.Worksheets[$Worksheetname] }
|
||||||
|
}
|
||||||
|
|
||||||
#In a script block to build a formula, we may want any of corners or the column name,
|
#In a script block to build a formula, we may want any of corners or the column name,
|
||||||
#if Column and Startrow aren't specified, assume first unused column, and first row
|
#if Column and Startrow aren't specified, assume first unused column, and first row
|
||||||
|
|||||||
@@ -116,8 +116,12 @@
|
|||||||
)
|
)
|
||||||
begin {
|
begin {
|
||||||
#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.
|
||||||
if ($ExcelPackage) {$Worksheet = $ExcelPackage.Workbook.worksheets[$Worksheetname] }
|
if ($ExcelPackage) {
|
||||||
|
if ($ExcelPackage.Workbook.Worksheets.Name -notcontains $Worksheetname) {
|
||||||
|
throw "The Workbook does not contain a sheet named '$Worksheetname'"
|
||||||
|
}
|
||||||
|
else {$Worksheet = $ExcelPackage.Workbook.Worksheets[$Worksheetname] }
|
||||||
|
}
|
||||||
#In a script block to build a formula, we may want any of corners or the columnname,
|
#In a script block to build a formula, we may want any of corners or the columnname,
|
||||||
#if row and start column aren't specified assume first unused row, and first column
|
#if row and start column aren't specified assume first unused row, and first column
|
||||||
if (-not $StartColumn) {$StartColumn = $Worksheet.Dimension.Start.Column }
|
if (-not $StartColumn) {$StartColumn = $Worksheet.Dimension.Start.Column }
|
||||||
|
|||||||
Reference in New Issue
Block a user