cancel
Showing results for 
Search instead for 
Did you mean: 
Community 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

mbaumga1
New Contributor II

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

WernerS
New Contributor III

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