Download table row

Hi everyone, I'm wondering if it's possible to set up a feature in Retool to allow downloading specific rows from a table in CSV format? Any guidance on how to achieve this would be greatly appreciated!

Hey @Goncalo_Santos

There is a built in download feature (in the New Table, not the Legacy Table) that will download the table as it is displayed on the screen, so if you can filter the table to show the rows you would like to download, you can use this.

You could use a search field or a filter to limit what is displayed and downloaded.

Alternatively, if you're looking to select multiple rows and download them, you have to get a little creative but it can be done. With your primary table set to allow multiple row selections, you can setup a secondary table that populates with the selected rows of the primary table.
Basically you end up with two tables, one with all your data and selected rows, and a second table with only your selected rows.

Then either use the built-in download feature on the secondary table, or create a button that calls a JS Query using the exportData function:

secondaryTable.exportData({fileName: 'TestCSV', fileType: 'csv'})

If you use the button and JS Query, it allows you to hide the secondary table. However, make sure you select the Maintain space when hidden feature on the hidden secondary table, or it won't update/download while hidden.

Maybe there's a feature of exportData that I'm not aware of that allows only selectedRows to be downloaded? If not, might be a nice feature request. Hope this helps!