Copy dataset to clipboard?

We use Google Sheets heavily, and getting data from Retool tables into the sheets can be onerous (you have to export to csv, and either (1) open Excel and copy/paste the data (2) import the whole file into Sheets using the import dialog).
Is there a way to simply copy a table to the clipboard so it can be pasted into Sheets? This would prevent having to export. This is one of my favorite features of Mode and would love to see it in Retool if possible. (https://mode.com/online-sql-editor/)


Screen Shot 2019-07-08 at 10.29.26.png

hi @austin-king!! great to hear from you again :slight_smile:

this sounds like a great feature! i’ll look into it sometime today and get back to you with an update

I’m assuming you want something like this:


so you can do this, with the Button component’s “copy to clipboard” feature. Here i was using this snippet:
{{ Papa.unparse(table1.data, { delimiter: '\t' }) }}

if your table is populated from a sql query, you might have to instead use this:
{{ Papa.unparse(formatDataAsArray(table1.data), { delimiter: '\t' }) }}

note that there’s currently a bug in production that stops this from working properly, but I’m pushing a fix for it tonight. if you try this tomorrow it should work just fine

Oh awesome! Very cool to see that this is currently possible. Thanks for the quick response!

This is cool. thanks. Is there a way to do this so it only copies the data values from a query and not the field names?
Yummly CCPA Tracker - Google Sheets 2020-08-07 12-10-49

Hey @yummly-mcg!

I was able to get this result with:

{{ Papa.unparse((formatDataAsArray(table1.data).map(d=>Object.values(d))), { delimiter: '\t' }) }}

or

{{ Papa.unparse((table1.data.map(d=>Object.values(d))), { delimiter: '\t' }) }}

Great-that does it - thanks!

1 Like