Forum Discussion

TheFifthJoin's avatar
TheFifthJoin
Advocate I
8 months ago
Solved

Read Notebook cell string from another notebook

Is this even possible?    I want to programatically loop through my transformation notebooks and parse the materialised lake view SQL to get a source field, destination field, and a bunch of other ...
  • Vinodh247's avatar
    8 months ago

    Fabric does not expose notebook cell contents through the public APIs today. Get Notebook Definition only returns metadata, not the code or markdown cells which is why the body field is always null. I believe the product team has not exposed any API to fetch notebook source programmatically.

     

    Possible options as of today:

    1. Store your SQL logic in external files (Lakehouse, Git, or a mirrored repo) and have notebooks read from there. Then you can parse those files easily.

    2. Use Fabric Git integration (if enabled) and parse the notebook source from the .ipynb representation in Git. That is currently the only reliable method to get notebook content automatically.

    3. Move your transformation logic into pipelines, dataflow gen2 or SQL scripts if you want first class lineage parsing.

    But directly reading notebook cell strings from another notebook or API is not supported today.