writes data into a notebook at the current selection, setting the current selection to be just after the data written.


replaces the given cell or box object instead of the current selection.


writes data into a notebook, setting the current selection to be as specified by sel.

Details and Options

  • The first argument of NotebookWrite can be a NotebookObject, CellObject, or BoxObject.
  • NotebookWrite to a NotebookObject does essentially the same as a Paste operation in the front end: it replaces whatever the current selection in the notebook is by data.
  • NotebookWrite to a CellObject replaces the given cell with the specified content. If no third argument is specified and the selection is not inside the cell, it does this without disturbing the current selection.
  • NotebookWrite is the basic way to use the Wolfram Language kernel to modify the contents of notebooks that are being manipulated by the front end.
  • NotebookWrite automatically wraps Cell around the data you specify if this is necessary.
  • Possible settings for sel are:
  • Afterplace the current selection immediately after the data written
    Allmake the current selection be the data written
    Beforeplace the current selection immediately before the data written
    Noneleave the current selection unchanged
    Placeholdermake the current selection be the first placeholder in the data written
  • The default for sel is After, so that NotebookWrite[obj,data] can be called repeatedly to insert several pieces of data in sequence.


open allclose all

Basic Examples  (1)

Create an empty notebook and write a cell:

Write another cell and select it:

Scope  (2)

Overwrite an existing cell:

Display a button that replaces itself when clicked:

Options  (1)

AutoScroll  (1)

First create an empty sample notebook to operate on:

Write a tall cell expression to the sample notebook and the scroll position remains at the top:

Properties & Relations  (1)

Use NotebookWrite to write over a selected part of the document:

Or use NotebookPut to replace the full contents:

Wolfram Research (1996), NotebookWrite, Wolfram Language function, (updated 2012).


Wolfram Research (1996), NotebookWrite, Wolfram Language function, (updated 2012).


Wolfram Language. 1996. "NotebookWrite." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2012.


Wolfram Language. (1996). NotebookWrite. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2022_notebookwrite, author="Wolfram Research", title="{NotebookWrite}", year="2012", howpublished="\url{}", note=[Accessed: 01-June-2023 ]}


@online{reference.wolfram_2022_notebookwrite, organization={Wolfram Research}, title={NotebookWrite}, year={2012}, url={}, note=[Accessed: 01-June-2023 ]}