Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Export-OfficeNotebook

Module
PSWriteOffice
Inputs
OfficeIMO.Notebook.NotebookDocument OfficeIMO.Notebook.NotebookOutput
Outputs
OfficeIMO.OfficeConversionReport

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>]
#
Parameter set: Document
Export-OfficeNotebook
[-NoClobber]
-Output <NotebookOutput>
[-Path] <String>
[<CommonParameters>]
#
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.

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

Export the first saved structured output from one code cell.

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

Extract PowerShell source without running the notebook.

$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.