If your project has a Scala class, you can extract a Spark method from a Zeppelin note to that class.

  1. Select a Spark method code fragment in the Zeppelin note.

  2. Right-click the selected code and select Refactor | Extract Spark Method from the context menu.

  3. In the dialog that opens, specify the Scala class (you can select it in project tree).

  4. Declare the method and press Refactor. The selected method code will be added to the target Scala class.