Porting an observable visualization to google sheets via apps script as add on

Hey everybody,

I was wondering if anybody has ever ported an observable visualization to google sheets via apps script as an add on before?

I think it might be doable and wondering whats the best solution to this.

Thank!

(I answered your same question on slack but I figured more people here might be interested)

I actually tried building this a long time ago! It was more of a prototype to see “will this work” rather than “I want to build and distribute this”, but its definitely possible and it works ok, but youll need to write a fair bit of code to get it to work. I dont remember too much about it and I dont have the code anymore, but I remember the google sheets sidebar API was very annoying and hard to work with. But the documentation for embeding/manipulating Observable notebook has gotten better, though!

I do have another project (GitHub - asg017/observable-prerender: Pre-render Observable notebooks for automation) that might make tools like this easier to build, since this demo was done all client-side in the browser and observable-prerender could be used to render charts server-side. I’ll be making a few examples of this in the next few weeks

2 Likes

Thanks for the tip!

I eventually used the Observable Runtime API to embed the notebook in the sidebar via javascript and redefine the notebooks data on button click, pretty straight forward.
This is a really nice tool to have when playing with data sources out of observable.
:slight_smile:

4 Likes

If you wrote up a tutorial notebook on how to do this, I’d be very interested in reading it!

3 Likes

Me too!

I will try to get something on github in the next couple of days!

3 Likes