Suggestion: "Download text"

The download JSON and PNG options are awesome and incredibly useful! It would be nice if there were an option to download string cells as text — my use case right now is to feed an external tool expecting a string, which I have generated in an Observable cell.

Cheers!

If you put square brackets around your string (["hello world"]), you’ll get the option to download it as JSON. Otherwise, you could use DOM.download:

DOM.download(new Blob(["hello world"], {type: "text/plain"}))

Edit: Added an example of DOM.download.

2 Likes

Thanks for the suggestions. As always, anything is possible in an Observable notebook.

My thinking was that this might be a common enough use case to warrant inclusion in the product interface, similar to the SVG and JSON export options. Of course, it may be strange to see it for shorter strings, and maybe it’s not a common enough need for most users to earn a spot in the menu.

Yes, that’s a reasonable suggestion. Thanks!

1 Like

The requested feature is now available: you can Download text on any cell whose value is a string. Thanks for the suggestion!

4 Likes

Truly fantastic. Thank you, Mike!

1 Like