Cells

Cells[]

returns a list of CellObject expressions corresponding to cells in the current notebook.

Cells[obj]

returns the list of CellObject expressions in obj.

Cells[NotebookSelection[notebook]]

returns the list of CellObject expressions for currently selected cells.

Details and Options

Examples

open allclose all

Basic Examples  (4)

Return a range of cells in the evaluation notebook:

Return all of the cells in a given notebook:

Return all of the inline cells in a given cell:

Return the first three Input cells in the evaluation notebook:

Scope  (5)

Return a list of any selected cells:

Give a list of values to an option to select cells that match any of the values:

Use multiple options to select the intersection of cells that match all of the listed criteria:

Use NotebookSelection to identify a selected cell:

Use NotebookSelection to identify all selected cells in a range selection:

Options  (9)

AttachedCell  (1)

Attach a cell to this input cell:

Return all cells attached to the cell:

Delete the attached cell:

CellID  (1)

Return the cell with a given CellID:

CellLabel  (1)

Return all cells with a given cell label:

CellStyle  (1)

Return all cells of a given style:

CellTags  (1)

Return cells with a given cell tag:

DockedCell  (1)

Create a notebook with a docked cell:

Read the docked cell:

Evaluator  (1)

Return all cells with a given evaluator:

GeneratedCell  (1)

Get only the generated cells from a notebook, including Output and Print cells:

Get only non-generated cells:

StripCellGrouping  (1)

Return information about how the cells are grouped:

Applications  (2)

Delete all generated cells in a notebook:

Change all cells of a given style to another style:

Properties & Relations  (1)

Cells only scans top-level cells for matching criteria, not inline cells:

However, if the selection is in an inline cell, you can get the inline cell's CellObject:

Possible Issues  (1)

Cells returns $Failed if the NotebookObject does not exist:

Wolfram Research (2012), Cells, Wolfram Language function, https://reference.wolfram.com/language/ref/Cells.html (updated 2024).

Text

Wolfram Research (2012), Cells, Wolfram Language function, https://reference.wolfram.com/language/ref/Cells.html (updated 2024).

CMS

Wolfram Language. 2012. "Cells." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/Cells.html.

APA

Wolfram Language. (2012). Cells. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Cells.html

BibTeX

@misc{reference.wolfram_2024_cells, author="Wolfram Research", title="{Cells}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/Cells.html}", note=[Accessed: 18-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_cells, organization={Wolfram Research}, title={Cells}, year={2024}, url={https://reference.wolfram.com/language/ref/Cells.html}, note=[Accessed: 18-December-2024 ]}