# Export-OfficeNotebook

Exports a live notebook or a selected saved structured output, returning the conversion report.

Cmdlet 

**Module**

`PSWriteOffice`

**Inputs**

`OfficeIMO.Notebook.NotebookDocument` `OfficeIMO.Notebook.NotebookOutput`

**Outputs**

`OfficeIMO.OfficeConversionReport`

**Source**

[ExportOfficeNotebookCommand.cs:28](https://github.com/EvotecIT/OfficeIMO/blob/51cd59ece1fa22f062b7419cfd3afa43c266a7cf/PowerShell/PSWriteOffice/Sources/PSWriteOffice/Cmdlets/Notebook/ExportOfficeNotebookCommand.cs#L28) 

Exports a live notebook or a selected saved structured output, returning the conversion report.

## Syntax

```
Export-OfficeNotebook
[-Author <String>]
-Document <NotebookDocument>
[-FailOnLoss]
[-IncludeCode]
[-IncludeExecutionCounts]
[-IncludeInteractiveCharts]
[-IncludeInteractiveWidgets]
[-IncludeOutputs]
[-NoClobber]
[-Path] <String>
[-PreserveMarkdownSource]
[-Title <String>]
[<CommonParameters>]
```

[#](#method-export-officenotebook-string-notebookdocument-switchparameter-switchparameter-switchparameter-switchparameter-switchparameter-switchparameter-switchparameter-string-switchparameter-string)

Parameter set: `Document`

```
Export-OfficeNotebook
[-NoClobber]
-Output <NotebookOutput>
[-Path] <String>
[<CommonParameters>]
```

[#](#method-export-officenotebook-switchparameter-notebookoutput-string)

Parameter set: `SavedTable`

## Description

Use .pdf, .html, .md, .docx or .ps1 for live notebooks. Pipe a saved structured table to write .csv or .xlsx. The command never runs cells and preserves an existing destination if conversion fails.

## Examples

### Export a PDF without showing code.

```powershell
$notebook | Export-OfficeNotebook -Path ./lab.pdf -IncludeCode:$false -Title 'Lab report'
```

### Export the first saved structured output from one code cell.

```powershell
$notebook | Get-OfficeNotebookCell -Index 2 | Get-OfficeNotebookOutput -Index 0 | Export-OfficeNotebook -Path ./results.xlsx
```

### Extract PowerShell source without running the notebook.

```powershell
$notebook | Export-OfficeNotebook -Path ./lab.ps1 -FailOnLoss
```

## Parameters

**-Author String optionalsets: Document**

Optional author for a rendered document.

**-Document NotebookDocument requiredpipeline: True (ByValue)sets: Document**

Live notebook to export to a document or a PowerShell script.

**-FailOnLoss SwitchParameter optionalsets: Document**

Reject a notebook export that reports fidelity loss before publishing a file.

**-IncludeCode SwitchParameter optionalsets: Document**

Include code in a rendered document. Enabled by default. Use -IncludeCode:$false to omit it.

**-IncludeExecutionCounts SwitchParameter optionalsets: Document**

Include saved execution counts in a rendered document. Enabled by default.

**-IncludeInteractiveCharts SwitchParameter optionalsets: Document**

Enable zoom, pan and saved data inspection in supported offline HTML charts.

**-IncludeInteractiveWidgets SwitchParameter optionalsets: Document**

Include supported, interactive saved-state widgets in a standalone HTML export.

**-IncludeOutputs SwitchParameter optionalsets: Document**

Include saved outputs in a rendered document. Enabled by default.

**-NoClobber SwitchParameter optional**

Refuse to replace an existing destination.

**-Path String requiredposition: 0**

Output path. The extension selects the format.

**-PreserveMarkdownSource SwitchParameter optionalsets: Document**

Preserve exact Markdown cell source in a Markdown export. Cell-local attachments are omitted with a report.

**-Title String optionalsets: Document**

Optional title for a rendered document.

**-Output NotebookOutput requiredpipeline: True (ByValue)sets: SavedTable**

Selected saved output containing an inline structured data resource.

## 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](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

<!-- PowerForge markdown artifact sha256:E2940DCA82F4EEB90C5F4C5670B6075A4AFE3F8E92240C8F2E9D726472739245 -->
