I found a (9 yo) plugin by @naveedahmada036 that does something like this for Google Sheets:
https://github.com/naveed-ahmad/plugin_discourse_spreadsheet
I tried it out, it more or less works (I need to whitelist google docs URLs). EDIT: I tried to whitelist option, but still not working well.
The plugin uses iframes (which are well supported in Discourse), This could be a solution for me, but I think it would be nicer to use javascripts.
This plugin also broke my WYSIWYG plugin basic editor, I wonder why.
EDIT 2: the plugin is actually by Daniel Fernández, I presume @Daniel_Fernandez_Pes