API Reference

Cmdlet

Edit-OfficeExcelRow

Aliases: Edit-ExcelRow, ExcelRowEdit
Namespace PSWriteOffice
Aliases
Edit-ExcelRow ExcelRowEdit
Inputs
OfficeIMO.Excel.ExcelDocument
Outputs
OfficeIMO.Excel.RowEdit

Runs a script block against editable worksheet rows.

Remarks

Runs a script block against editable worksheet rows.

Examples

Authored help example

Edit rows by header name.

PS>


Edit-OfficeExcelRow -Path .\Report.xlsx -Sheet Data -ScriptBlock { param($row) if ($row.Get[string]('Status') -eq 'Draft') { $row.Set('Status', 'Ready') } }
        

Loads editable row handles, lets the script update cells, and saves the workbook.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.

Syntax

Edit-OfficeExcelRow -InputPath <String> [-NumericAsDecimal] [-PassThru] [-Range <String>] -ScriptBlock <ScriptBlock> [-Sheet <String>] [-SheetIndex <Nullable`1>] [<CommonParameters>]
#
Parameter set: Path

Parameters

InputPath String requiredposition: 0pipeline: Falsealiases: FilePath, Path
Workbook path to update.
NumericAsDecimal SwitchParameter optionalposition: namedpipeline: False
Prefer decimals instead of doubles for numeric values.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit each editable row after the script block runs.
Range String optionalposition: namedpipeline: False
A1 range to expose as editable rows. Defaults to the worksheet used range.
ScriptBlock ScriptBlock requiredposition: 1pipeline: False
Script block to run once per editable row. The row is passed as the first argument.
Sheet String optionalposition: namedpipeline: Falsealiases: WorksheetName
Worksheet name. Defaults to the current sheet inside an ExcelSheet block.
SheetIndex Nullable`1 optionalposition: namedpipeline: False
Worksheet index when using a workbook object or path.

Outputs

OfficeIMO.Excel.RowEdit

Edit-OfficeExcelRow -Document <ExcelDocument> [-NumericAsDecimal] [-PassThru] [-Range <String>] -ScriptBlock <ScriptBlock> [-Sheet <String>] [-SheetIndex <Nullable`1>] [<CommonParameters>]
#
Parameter set: Document

Parameters

Document ExcelDocument requiredposition: namedpipeline: True (ByValue)
Workbook to update outside the DSL context.
NumericAsDecimal SwitchParameter optionalposition: namedpipeline: False
Prefer decimals instead of doubles for numeric values.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit each editable row after the script block runs.
Range String optionalposition: namedpipeline: False
A1 range to expose as editable rows. Defaults to the worksheet used range.
ScriptBlock ScriptBlock requiredposition: 1pipeline: False
Script block to run once per editable row. The row is passed as the first argument.
Sheet String optionalposition: namedpipeline: Falsealiases: WorksheetName
Worksheet name. Defaults to the current sheet inside an ExcelSheet block.
SheetIndex Nullable`1 optionalposition: namedpipeline: False
Worksheet index when using a workbook object or path.

Outputs

OfficeIMO.Excel.RowEdit