Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Set-OfficeNotebookCell

Module
PSWriteOffice
Inputs
OfficeIMO.Notebook.NotebookCell
Outputs
OfficeIMO.Notebook.NotebookCell

Updates cell text or a saved code-cell execution count without running code.

Syntax

Set-OfficeNotebookCell
-Cell <NotebookCell>
[-ExecutionCount <Int32>]
[-PassThru]
[-Source <String>]
[<CommonParameters>]
#
Parameter set: All Parameter Sets

Examples

Replace one cell's source and clear its execution count.

$notebook | Get-OfficeNotebookCell -Index 1 | Set-OfficeNotebookCell -Source 'Get-Date' -ExecutionCount $null

Parameters

-Cell NotebookCell requiredpipeline: True (ByValue)
Cell to edit. Keep its notebook open until the edit is complete.
-ExecutionCount Int32 optional
Saved execution count for a code cell. Supply $null to clear it.
-PassThru SwitchParameter optional
Return the updated cell.
-Source String optional
Replacement cell text.

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.