# Overriding a cell when using Observable Runtime

**URL:** <https://talk.observablehq.com/t/overriding-a-cell-when-using-observable-runtime/5103>\
**Category:** Help\
**Created:** [May 24, 2021, 8:26pm UTC](https://talk.observablehq.com/t/overriding-a-cell-when-using-observable-runtime/5103 "2021-05-24T20:26:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![harris](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/harris/32/3326_2.png) [@harris](https://talk.observablehq.com/u/harris)\
**Post date:** [May 24, 2021, 8:26pm UTC](https://talk.observablehq.com/t/overriding-a-cell-when-using-observable-runtime/5103/1 "2021-05-24T20:26:26Z")

</div>

I’m trying to understand the Observable runtime a bit better. I understand that I can use this code to embed a cell in an element on any page:

```auto
<div id="embedded-nb">
  <div class="embedded-chart"></div>
</div>

<script type="module">
  import {Runtime, Inspector} from "https://cdn.jsdelivr.net/npm/@observablehq/runtime@4/dist/runtime.js";
  import define from "https://api.observablehq.com/path/to/notebook?v=3"
  (new Runtime).module(define, name => {
    if (name === 'cellName') return Inspector.into("#embedded-nb .embedded-chart")()
  });
</script>

```

Is there a way to inject dependencies while doing this on an arbitrary HTML page? Similar to how I can do:

```auto
import { cellName } with { injectedValue as cellDependency } from "path/to/notebook"

```

inside of a notebook.

---

<div class="post-metadata">

**Author:** ![tophtucker](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/tophtucker/32/4781_2.png) [@tophtucker](https://talk.observablehq.com/u/tophtucker)\
**Post date:** [May 24, 2021, 8:45pm UTC](https://talk.observablehq.com/t/overriding-a-cell-when-using-observable-runtime/5103/2 "2021-05-24T20:45:57Z")

</div>

You bet! We have several examples of this in [our repo of runtime examples](https://github.com/observablehq/examples/). Here’s one that [loads a local JSON file](https://github.com/observablehq/examples/blob/main/custom-data/index.html):

```auto
<script type="module">

import {Runtime, Inspector} from "https://cdn.jsdelivr.net/npm/@observablehq/runtime@4/dist/runtime.js";
import notebook from "https://api.observablehq.com/@d3/zoomable-sunburst.js?v=3";

// Instantiate the notebook.
const runtime = new Runtime();
const main = runtime.module(notebook, name => {
  if (name === "chart") {
    return new Inspector(document.querySelector("#chart"));
  }
});

// Redefine the cell “data” as the contents of the local file population.json;
// this will affect the chart embedded above.
main.redefine("data", fetch("population.json").then(response => response.json()));

</script>

```

---

<div class="post-metadata">

**Author:** ![harris](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/harris/32/3326_2.png) [@harris](https://talk.observablehq.com/u/harris)\
**Post date:** [May 24, 2021, 8:47pm UTC](https://talk.observablehq.com/t/overriding-a-cell-when-using-observable-runtime/5103/3 "2021-05-24T20:47:44Z")

</div>

Oh, perfect! Thank you!
