How to allow my site user to download queried JSON data as JSON or CSV file?

I’m trying to have a button that allows signed-in users to download any data that they query, as a .csv or .json file.

I tried new Blob() in the Run Code interaction, but I don’t think Plasmic’s js supports the Blob constructor.

I’ve also tried createURIObject, but I’m not sure if I should use that as it’s a lot of rows being queried by users.

I’m using Supabase’s database as integration in Plasmic.

Hello @puvi. You should be able to use new Blob(), even if it errors in the Run Code interaction. We will be fixing the issue, thanks for reporting it.

1 Like

Thanks for replying @icaro_guerra , I just tried it out, but I can’t test it out for certain. Since the page navigation is disabled, I can’t get the downloadable .csv file.

Tried to publish to plasmic hosting to try out the file download, but the whole site is 404 now.

Hi @icaro_guerra, using Blob in Run Code works now.

Plasmic doesn’t show an error anymore when using blob in custom expressions.

I’ve created a new project to test out using blob.

There’s button to add data as a blob from a state array to a state object.

My findings :

  1. When Add Data to Blob is clicked in Preview , everything works fine.
    image

  2. When Add Data to Blob is clicked in Interactive Mode Plasmic Studio completely freezes.

It’s not an issue for me at the moment, as using new Blob() now works, however just informing that this issue exists.

Thanks for reporting the issue. We will be looking into it.

1 Like