cancel
Showing results for 
Search instead for 
Did you mean: 
Community Platform Discussions
Connect with fellow community members to discuss general topics related to the Databricks platform, industry trends, and best practices. Share experiences, ask questions, and foster collaboration within the community.
cancel
Showing results for 
Search instead for 
Did you mean: 

Automate running the first two command cells of all my notebooks

Anonymous
Not applicable

I extensively use widgets in my Databricks notebooks, to provide interactivity to the community that runs my notebooks interactively. In the current setup we have, whenever I push my notebooks from dev to prod, the widgets are erased and have I have to create them manually. We know that this can be avoided by changing the way we move them from dev to prod, but for another issue, this is not possible yet. So in the meantime, my question is: Is it possible to write a notebook that would loop through all the notebooks in the same folder, and simply run the first two command cells in every notebook? Thanks!

1 REPLY 1

Anonymous
Not applicable

have you tried dbutils.notebook.exit('whatever you want to type here') after the two cells?

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group