Here is an example notebook:

Scrape the text from “Section” and “Text” cells in the notebook:

Preserve the cell grouping structure in the notebook by specifying the rule “FlattenCellGroups”False:
- NotebookImport can import from notebook files or open notebooks.