Wolfram Language & System 10.3 (2015)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

NotebookImport

NotebookImport[notebook,style]
imports cells with the given cell style from the specified notebook.

NotebookImport[notebook,styleform]
imports cells in the form specified by form.

Details and OptionsDetails and Options

  • In NotebookImport[notebook,], notebook can be a NotebookObject, a file name, a CloudObject corresponding to a notebook, or a Notebook expression.
  • If style is a pattern, cells whose style matches that pattern are imported. A typical pattern is "name1"|"name2"|, indicating to import any of the styles .
  • If style is , all cells are imported.
  • Possible values for form include:
  • "Boxes"first argument of low-level cell expression
    "Cell"complete low-level cell expression
    "Expression"cell converted to an expression
    "HeldExpression"cell converted to a held expression
    "HeldInterpretedCell"cell converted to a held TextCell or ExpressionCell
    "Hyperlinks"list of hyperlinks in the cell
    "InactiveExpression"cell converted to an inactive expression
    "InputText"cell contents as given by Copy As Input Text
    "InterpretedCell"cell converted to a TextCell or ExpressionCell
    "Text"cell contents as given by Copy As Plain Text
  • The following options can be given:
  • "FlattenCellGroups"Truewhether to flatten nested lists corresponding to the cell group hierarchy
    "StyleImportRules"Automaticspecify forms to return for different cell styles
  • With the setting "FlattenCellGroups"->False, one level of list will be present for every cell group in the notebook, whether or not any cells were imported from that group.
  • The setting is equivalent to the following mappings:
  • "Title""Text"
    "Chapter"
  • "Text"
  • "Subchapter"
  • "Text"
  • "Section"
  • "Text"
  • "Subsection"
  • "Text"
  • "Subsubsection"
  • "Text"
  • "Text"
  • "Text"
  • "Code"
    "Input""HeldExpression"
    "Output""Expression"
    "Message""Text"
    "Print"
  • Other styles are given in form.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

Create a notebook:

In[1]:=
Click for copyable input

Import the cells in this notebook to the default forms:

In[2]:=
Click for copyable input
Out[2]=

Import cells in this notebook as a list of text strings:

In[3]:=
Click for copyable input
Out[3]=

Import only Input style cells, as held expressions:

In[4]:=
Click for copyable input
Out[4]=

Import input cells as evaluatable text:

In[5]:=
Click for copyable input
Out[5]=

Import input cells as inactive expressions:

In[6]:=
Click for copyable input
Out[6]=

Import all input and output cells from a notebook, preserving cell grouping information:

In[7]:=
Click for copyable input
Out[7]=

Import evaluatable text for every input and output cell:

In[8]:=
Click for copyable input
Out[8]=
Introduced in 2015
(10.1)