# Access to variables from outside Observable

**URL:** <https://talk.observablehq.com/t/access-to-variables-from-outside-observable/455>\
**Category:** Help\
**Created:** [March 5, 2018, 10:23pm UTC](https://talk.observablehq.com/t/access-to-variables-from-outside-observable/455 "2018-03-05T22:23:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![eloyer](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/eloyer/32/636_2.png) [@eloyer](https://talk.observablehq.com/u/eloyer)\
**Post date:** [March 5, 2018, 10:23pm UTC](https://talk.observablehq.com/t/access-to-variables-from-outside-observable/455/1 "2018-03-05T22:23:39Z")

</div>

My question: variables can be imported from one notebook to another (awesome), but is there a way to access a notebook’s variables from outside Observable? I’d like to use a notebook to programmatically assemble some data, and then access that data from elsewhere. Thanks…

---

<div class="post-metadata">

**Author:** ![jashkenas](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/jashkenas/32/1778_2.png) [@jashkenas](https://talk.observablehq.com/u/jashkenas)\
**Post date:** [March 5, 2018, 10:58pm UTC](https://talk.observablehq.com/t/access-to-variables-from-outside-observable/455/2 "2018-03-05T22:58:08Z")

</div>

At the moment, there isn’t a convenient way to load data directly from an Observable notebook. But we’re working on it! A feature for downloading a notebook to run standalone, and/or embedding a notebook on your website — including being able to access the live values of cells — is in the works.

In the meantime, I’d recommend using the `DOM.download` function in the standard library to export your final, processed data as a JSON file that you can then use anywhere you please.

See: [https://beta.observablehq.com/@mbostock/standard-library](https://beta.observablehq.com/@mbostock/standard-library) and [https://beta.observablehq.com/@mbostock/saving-svg](https://beta.observablehq.com/@mbostock/saving-svg) for some `DOM.download` examples.

---

<div class="post-metadata">

**Author:** ![Fil](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/fil/32/207_2.png) [@Fil](https://talk.observablehq.com/u/Fil)\
**Post date:** [March 6, 2018, 9:03am UTC](https://talk.observablehq.com/t/access-to-variables-from-outside-observable/455/3 "2018-03-06T09:03:09Z")

</div>

[Saving SVG / Mike Bostock | Observable](https://beta.observablehq.com/@mbostock/saving-svg) fails on my computer with Firefox:

> “Content Security Policy: Les paramètres de la page ont empêché le chargement d’une ressource à blob:null/91cfa61f-27f3-a146-8f3e-348ed4d32958 (« frame-src [https://static.observableusercontent.com](https://static.observableusercontent.com) »).”

(It works on Chrome.)

---

<div class="post-metadata">

**Author:** ![eloyer](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/eloyer/32/636_2.png) [@eloyer](https://talk.observablehq.com/u/eloyer)\
**Post date:** [March 6, 2018, 5:05pm UTC](https://talk.observablehq.com/t/access-to-variables-from-outside-observable/455/4 "2018-03-06T17:05:58Z")

</div>

OK, thanks! Looking forward to future developments.

---

<div class="post-metadata">

**Author:** ![jashkenas](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/jashkenas/32/1778_2.png) [@jashkenas](https://talk.observablehq.com/u/jashkenas)\
**Post date:** [March 6, 2018, 5:47pm UTC](https://talk.observablehq.com/t/access-to-variables-from-outside-observable/455/5 "2018-03-06T17:47:15Z")

</div>

@Fil: Thanks for the bug report! I’ve added `blob:` and `data:` frame sources to our Content Security Policy — so you should be able to use `DOM.download` from Firefox without problems now.

Let us know if you run into anything else!

---

<div class="post-metadata">

**Author:** ![jashkenas](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/jashkenas/32/1778_2.png) [@jashkenas](https://talk.observablehq.com/u/jashkenas)\
**Post date:** [May 21, 2018, 7:45pm UTC](https://talk.observablehq.com/t/access-to-variables-from-outside-observable/455/6 "2018-05-21T19:45:28Z")

</div>

@eloyer,

We’ve launched embeddable notebooks this morning, which means that you can now programmatically access a notebook’s variables from anywhere you’d like.

> **[Downloading and Embedding Notebooks](https://observablehq.com/@jashkenas/downloading-and-embedding-notebooks)**
>
> An Observable notebook.

The full details are available in that link, but in short:

```auto
Runtime.load(notebook, (variable) => {
  if (variable.name === "data") {
    return {
      fulfilled: (value) => myApp.setData(value)
    };
  }
});

```

Enjoy!

---

<div class="post-metadata">

**Author:** ![eloyer](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/eloyer/32/636_2.png) [@eloyer](https://talk.observablehq.com/u/eloyer)\
**Post date:** [May 22, 2018, 2:06am UTC](https://talk.observablehq.com/t/access-to-variables-from-outside-observable/455/7 "2018-05-22T02:06:09Z")

</div>

Excellent, thanks for the update—can’t wait to try it out!
