Create new workbooks with code

invalidargument
New Contributor III

Is is possible to create new notebooks from a notevbook in databricks?

 

I have tried this code. But all of them are generic files, not notebooks.

notebook_str = """# Databricks notebook source

import pyspark.sql.functions as F
import numpy as np

# COMMAND ----------

# A test notebook
np.__version__
"""
with open("./notebook.ipynb","w") as f:
    f.write(notebook_str)

with open("./notebook.py","w") as f:
    f.write(notebook_str)

with open("./notebook","w") as f:
    f.write(notebook_str)