cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How do I clear all output results in a notebook?

KendraVant
New Contributor II

I'm building notebooks for tutorial sessions and I want to clear all the output results from the notebook before distributing it to the participants.

This functionality exists in Juypter but I can't find it in Databricks. Any pointers?

1 ACCEPTED SOLUTION

Accepted Solutions

holly
Valued Contributor III

Yes! Run > โ€ƒClear >  Clear all cell outputs

Screenshot 2024-07-01 at 12.18.42.png

Fun fact, this feature was made ~10 years ago when we realised all our customer demos looked very messy and had lots of spoilers in them!

View solution in original post

7 REPLIES 7

Arun_KumarPT
New Contributor II

Hi Kendrav,

I used to export the notebook after my work. The exported notebooks will not have any output messages. You can distribute the exported notebooks.

Hi Arunkumar. Unfortunately that doesn't seem to work for me. Did you do anything special before you exported? I still find all the results display when I import a notebook from someone else.

Arun_KumarPT
New Contributor II

's3Connection' is a scala notebook.

For export,

0693f000007OrmiAAC

For import,

0693f000007OrmjAAC

Thanks Arumkumar. Hopefully simpler functionality is on it's way.

schnee1
New Contributor III

I recently watched a webinar in which @rxin clear the results from the Javascript Console (in Chrome)

View -> Developer -> JavaScript Console

and then type "notebook.clearResults()"

The webinar was about Spark 2.0, which was great, but that little bit of JavaScript was a gem. Databricks should expose that in the UI somewhere.

schnee1's solution seems like it might not work since the function appears to be called client side, but I just tried this in MS Edge on Windows 11 and it seemed to fix the problem where I couldn't clone a Notebook that had too much cell output. Very strange. Also, I agree with schnee1 that the "notebook.clearResults()" function call should be made available as a client-side button.

holly
Valued Contributor III

Yes! Run > โ€ƒClear >  Clear all cell outputs

Screenshot 2024-07-01 at 12.18.42.png

Fun fact, this feature was made ~10 years ago when we realised all our customer demos looked very messy and had lots of spoilers in them!

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