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. (- Answer any Question with SQL | Mode)
this sounds like a great feature! i’ll look into it sometime today and get back to you with an update
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?
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!
i am geeting issue to copy data from retool and paste into csv or excel
Hi @Dhrumil_Modi Thanks for reaching out! I saw a support ticket with your colleague where this was solved with the following code
{{ Papa.unparse((insertYourTableNameHere.selectedRows.map(d=>Object.values(d))), { delimiter: '\t' }) }}