How to pass parameters to a notebook via URL?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I have a Notebook written in Python, and a Notebook's Dashboard that shows its result.
The Notebook has a parameters, processed with a text widget:
dbutils.widgets.text("p_test", "", "Enter Test Value")
p_test = dbutils.widgets.get("p_test")
When I enter a value in the widget's text box, it works ok.
The question. I want to call this notebook (more precisely speaking - its Dashboard) from another web page via a link, passing a value of the parameter in the URL.
The problem. If I copy the link to the dashboard and add a "...&p_test=my_value" at the end, the value is not passed to the widget and to the notebook.
I've found, in new-style AI/BI dashboards they pass parameters in the URL not by its names, but with its unique codes started from "f_nnnn..." so we can enter values to widgets, inspect these codes in the URL and use them to construct your own URL with your own values. But it looks like it does not work for dashboards linked to notebooks. I can't inspect any parameters in the URL while entering values to widgets and running the dashboard.
So, how can I call notebook's dashboard via link with parameters passed in the link?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
To pass parameters to a notebook via URL in Databricks, you can use the %run
magic command along with the parameters you want to pass.
When you run the notebook, you can pass the parameters using the %run
command followed by the notebook path and the parameters.
%run /path/to/notebook $param1="value1" $param2="value2"
In this example, param1
and param2
are the names of the widgets in the target notebook, and "value1"
and "value2"
are the values you want to pass to these parameters
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Okay, I tried what you are doing,
When you create a dashboard from the notebook, Databricks generates a unique URL for the dashboard. This URL typically does not expose the widget parameters directly.
I will try to find if there is an alternate way.

