API Reference
Cmdlet
Edit-OfficeExcelRow
Runs a script block against editable worksheet rows.
Remarks
Runs a script block against editable worksheet rows.
Examples
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:
PathParameters
- InputPath String
- Workbook path to update.
- NumericAsDecimal SwitchParameter
- Prefer decimals instead of doubles for numeric values.
- PassThru SwitchParameter
- Emit each editable row after the script block runs.
- Range String
- A1 range to expose as editable rows. Defaults to the worksheet used range.
- ScriptBlock ScriptBlock
- Script block to run once per editable row. The row is passed as the first argument.
- Sheet String
- Worksheet name. Defaults to the current sheet inside an ExcelSheet block.
- SheetIndex Nullable`1
- 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:
DocumentParameters
- Document ExcelDocument
- Workbook to update outside the DSL context.
- NumericAsDecimal SwitchParameter
- Prefer decimals instead of doubles for numeric values.
- PassThru SwitchParameter
- Emit each editable row after the script block runs.
- Range String
- A1 range to expose as editable rows. Defaults to the worksheet used range.
- ScriptBlock ScriptBlock
- Script block to run once per editable row. The row is passed as the first argument.
- Sheet String
- Worksheet name. Defaults to the current sheet inside an ExcelSheet block.
- SheetIndex Nullable`1
- Worksheet index when using a workbook object or path.
Outputs
OfficeIMO.Excel.RowEdit