Export as CSV, Download and then Delete

I have gone through the discussions and found some valuable information. I’m still stuck on the logic and what my SA would look like. What I need to do is:

  • Display a recordset and convert to CSV button
  • Pull just the email addresses in the convert
  • Automatically download the file
  • Delete the file after download

What I need to end up with is a comma separated list of email addresses to either copy and pasted into Outlook or imported into Outlook. Basically an email list.

Is this possible?

Hi.
If you just want to copy some information to be pasted somewhere, you can try using clipboard.
So the recordset that you are displaying could be the data source.
Just give a button to copy, on click of which, copy the email column’s data to clipboard.
There are options in Wappler’s browser component to do so. I haven’t used it so not sure how exactly it would work.

But if that doesn’t work for you, you can just create a simple custom formatter and use JS magic to copy items to clipboard.
Then, paste into Outlook.

You can also do some advanced stuff in the copied content - for eg: copy first name, last name and email in a format that Outlook can render so instead of seeing email addresses, you would see names in the email address field. Just an idea, not sure if Outlook supports this.

Is the recordset then already downloaded and shown on the page? Why not do the conversion client-side then instead of querying the same data again on the server to convert it there and serve it as a file.

Following expression will generate a comma separated list of email addresses. You could use that as a value for a textarea where the user then simply can copy it. Or with some custom code you could put it in the clipboard for the user or server it as a file.

serverconnect1.data.values('email').join(',')
4 Likes

I just used this today, and there is an option called "write to clipboard", under browser.
Using the code Patrick has suggested above, you could just add CSV emails to clipboard directly.

1 Like

Thank you @sid and @patrick! :beers:

I think you guys have given me a new way to look at it. Simple solution. I will post my results.