- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2024 11:45 AM
If I want to move multiple (hundreds of) notebooks at the same time from one folder to another, what is the best way to do that? Other than going to each individual notebook and clicking "Move".
Is there a way to programmatically move notebooks? Like automatically move notebooks to an Archive folder based on last edit date, etc.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2024 08:08 AM
The best way to move multiple notebooks at the same time from one folder to another is by using the Databricks workspace API to export and then import the notebooks into the new folder. This can be done from the UI at the top of the screen near to the Share option, on the 3 vertical dots you can select export option, this will generate a file with all the notebooks and folders on the page, then you can import them in the desired folder.
To do it programmatically you can refer to KB: https://kb.databricks.com/notebooks-internal/1333098-how-to-migrate-shared-folders-and-the-notebooks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2024 08:08 AM
The best way to move multiple notebooks at the same time from one folder to another is by using the Databricks workspace API to export and then import the notebooks into the new folder. This can be done from the UI at the top of the screen near to the Share option, on the 3 vertical dots you can select export option, this will generate a file with all the notebooks and folders on the page, then you can import them in the desired folder.
To do it programmatically you can refer to KB: https://kb.databricks.com/notebooks-internal/1333098-how-to-migrate-shared-folders-and-the-notebooks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2024 01:46 PM
Hi, thank you for your response. The link goes to HelpJuice, which I do not have access to. Do you know of an alternative resource/way to view that/etc.?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Monday
How to copy the notebook from one environment to another programmatically?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2024 09:18 AM
You should be redirected to the KB page, but this is the information contained:
Problem
How to migrate Shared folders and the notebooks
Cause
Shared notebooks are not migrated into new workspace by default
Solution
Please find the script to migrate the Shared folder data.
import sys import os import subprocess from subprocess import call, check_output EXPORT_PROFILE = "primary" IMPORT_PROFILE = "secondary" # Get a list of all users # Export sandboxed environment(folders, notebooks) for each user and import into new workspace. #Libraries are not included with these APIs / commands. #print("Trying to migrate workspace for user ".decode() + user) print ("Trying to migrate workspace for Shared folders ") export_exit_status = call("databricks workspace export_dir /Shared/" + " ./" + " --profile " + EXPORT_PROFILE, shell = True) import_exit_status = call("databricks workspace import_dir ./Shared/ /Shared/" + " --profile " + IMPORT_PROFILE, shell=True) print ("All done")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Monday
How to do this for other environments?
For example how to copy the notebooks from dev to int ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Monday
You can use the export and import API calls in order to export this notebook to your local machine and then import it to the new workspace.
Export: https://docs.databricks.com/api/workspace/workspace/export
Import: https://docs.databricks.com/api/workspace/workspace/import
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Monday
Yes @Walter_C , i tried this it is able to export the notebook and while doing import in the another environment it is not doing correctly, do you have any sample code for this. And one more thing they are using unity catalog, they are restricting the access to create notebook in workspace that is the reason why I am not able to do import the notebook or something else?
Can you pls help me with these process?

