Programmatically create new cells?

I’m thinking about building a custom API explorer for a JSON web API. I’d like to be able to display a list of items from the API and have the user click on one of those items to trigger an additional API request to fetch more information about that specific item.

It struck me that it would be really interesting to dynamically create new cells based on the user’s interactions with previous ones. Is that possible? If not, is it something you could add? Some kind of JavaScript method for programmatically appending and executing a new cell to the current notebook.

2 Likes

Here we are 5 years later, in the age of ChatGPT. I would also like to programmatically create cells. Use case is to create a JavaScript based code interpreter via OpenAI API in Observable notebooks.