-werners-
Esteemed Contributor III

I am sure there is a trick but I doubt it is the best way:

the actual notebooks store each cell as # COMMAND ------ and markdown as # MAGIC %md.

So you could fetch the actual notebook code and start rebuilding it in python with a loop/count over COMMAND or MAGIC.

But as I said: seems overkill. Databricks can parse it nicely so there has to be a way.