cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Processing Notebook in python

Avinash_Narala
New Contributor III

Hi,

I exported notebook from my workspace into my local machine and want to read it in my python code .

Is there a way to read the content of my notebook programmatically and make necessary changes and save as dbc/html notebook.

 

2 REPLIES 2

ossinova
Contributor II

Not sure what you are trying to accomplish here. If you want to export a notebook as python to do manual editing locally, and then import it back into your workspace why not use repos and connect to it using VSCode etc? You can export the notebook as a python file. Just don't delete the top # Databricks notebook source line. Otherwise you can also use DBConnect and the VSCode Databricks Extension to run the code locally using your Databricks custer. 

I want to automate the refactoring, so using DBConnect and VScode extension I can develop my code.

But I want to modify already written code.

Like, Example: if in my old_notebook whereever there is table1 i need to replace with table2.

For these I need to read notebook and replace the content programmatically. 

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.