cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert SQL array of objects to CSV for email attachment

shaked
Deputy Chef I
Deputy Chef I

 

Hi,

I have a result from a SQL query that comes as an array of objects, like this:

[
{ NAME: "BON", NUMBER: 21 }
, { NAME: "JON", NUMBER: 51 }
]
I want to convert this into a CSV file so I can send it as an email attachment. What’s the best way to do this in Workato?
2 REPLIES 2

francbaviello
Deputy Chef III
Deputy Chef III

Hi @shaked , you can to use:

'Compose CSV': where you set the 'CSV data lines source list' field with the array of objects;

'Send email': where you set the 'Binary file content' field with the value 'CSV contents'.

shivakumara
Executive Chef III
Executive Chef III

Hi @shaked ,

You can use the Compose CSV action to generate the file content, as the content remains the same.
Please refer to the attached screenshot for reference.



Compose CSV data.pngCompose CSV Mail.png

Thanks and Regards,
Shivakumara K A