Easiest way to export and download a single table?
I'd like to implement a system where a user can press a button on a page and download one of the tables the project produces. What would be the easiest way to do this?
Thanks
3 Replies
Can you say more, I'm trying to think about what it means for a project to produce a table. Do you know the table name ahead of time? How big is the table?
When you say download, what format would you like the table to be in? e.g. download it as a CSV?
Thanks for the response! You'd know the table name ahead of time and it wouldn't be larger than 1MB. The current format for exporting snapshots would be fine, but if it needed to be a CSV or other format that wouldn't be an issue.
Then I'd write a Convex HTTP endpoint that runs a query to read the entire table, and formats it as a CSV and includes the appropriate headers to make it a download.
But you could also use a convex.query() to grab the data and do the download stuff on the client.