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 FlattenCellGroupsFalse: