mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
Trap invalid worksheet name in Set-ExcelRow/Column
This commit is contained in:
@@ -36,8 +36,8 @@ function New-ConditionalText {
|
||||
|
||||
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
|
||||
"Finish Position". The range could be written "C:C" to specify a named
|
||||
column, or "C2:C102" to specify certain cells in the column.
|
||||
"Finish Position". The range could be written -Range "C:C" to specify a
|
||||
named column, or -Range "C2:C102" to specify certain cells in the column.
|
||||
.Link
|
||||
Add-Add-ConditionalFormatting
|
||||
New-ConditionalFormattingIconSet
|
||||
|
||||
@@ -53,11 +53,14 @@ Install-Module ImportExcel -scope CurrentUser
|
||||
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
|
||||
|
||||
- Thank you to Conrad Agramont, Twitter: [@AGramont](https://twitter.com/@AGramont) for the `AddMultiWorkSheet.ps1` example. Much appreciated!
|
||||
- Fixed several more bugs where parametrs were ignored if passed a zero value
|
||||
- Fixed bug where chart series headers could not come form a cell refernce (=Sheet1!Z10 now works as a header reference)
|
||||
- Fixed several more bugs where parameters were ignored if passed a zero value
|
||||
- Fixed bug where chart series headers could not come form a cell reference (=Sheet1!Z10 now works as a header reference)
|
||||
- Add-Chart will now allow a single X range, or as many X ranges as there are Y ranges.
|
||||
- Merge-MultipleSheets is more robust.
|
||||
- Set-ExcelRow and Set-ExcelColumn trap attempts to process a sheet with no rows/columns.
|
||||
|
||||
@@ -121,7 +121,12 @@
|
||||
|
||||
begin {
|
||||
#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,
|
||||
#if Column and Startrow aren't specified, assume first unused column, and first row
|
||||
|
||||
@@ -116,8 +116,12 @@
|
||||
)
|
||||
begin {
|
||||
#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,
|
||||
#if row and start column aren't specified assume first unused row, and first column
|
||||
if (-not $StartColumn) {$StartColumn = $Worksheet.Dimension.Start.Column }
|
||||
|
||||
Reference in New Issue
Block a user