Attach CSV to Email in worfklow

I have an equipment status query i run in postgres that I then export to a CSV file using datagrip. I thought I'd set up a simple workflow in retool to try to attach this to an email so all I had to do was paste it into google sheets and run the mail merge using YAMM. That proved to be a challenge. No matter what I tried I could not get the attachment to show up in the workflow. I could generate the query, convert it to a csv file, even save it to retool storage and retrieve it. But i could not get it to attach to the email. I ended up having to just store it in retool and send an email with a link. which then gets downloaded when I click on it. I'd like to use retool for other things later that will have attachments. How do I attach a file that's an output from a query?

Hi @David_Bolen,

My guess is you were pretty close. I had to save the csv to storage, retrieve the file again and send it.

If needed I can send you the json of my test workflow. Works like a charm!

4 Likes

Thanks Shawn,

I found this in one of the blogs on retool a little while after I posted.

[{data: {{file1.base64data}}, name: 'file1name.pdf', contentType: 'pdf' }, {data: {{file2.base64data}}, name: 'file2name.pdf', contentType: 'pdf' }]

I did the same thing, saving to storage then used the above in the attachment. IT WORKED!

Thanks for the reply!

Dave Bolen, COO | PowderWatts
O: 801-477-7756 | C: 816-492-0467 | davebolen@powderwatts.com

285 N Main St #302, Kaysville, UT 84037

1 Like

Hi Dave,

I'm glad you found a solution. It's a fairly active and fun community. Don't hesitate to reach out!

2 posts were split to a new topic: How to configure table row grouping via component inspector