cancel
Showing results for 
Search instead for 
Did you mean: 

Best way to create a list of CSVs to attach to an email

matt-kruzicki
Deputy Chef II
Deputy Chef II

I've looked through lists by workato, variables by workato, files by workato and can't find a great way to take all the CSVs created in a repeat step/loop (CSV Parser by workato) and add each of them to an email (as attachments). Any advice?

1 ACCEPTED SOLUTION

Multiple CSVs all as separate attachments. I did end up getting it to work just using the String datatype. Much appreciated!

View solution in original post

6 REPLIES 6

gary1
Executive Chef II
Executive Chef II

Hi Matt,


If you want to add each individual CSV to the same email, you'll have to add the CSV file content and filenames to a new list within your loop to create a list of all attachments. Then outside of the loop, you can feed the list of attachments to the "Email by Workato" connector, and it will attach all items in the list individually. If you want to send a one email per CSV, you can move the emailer inside the loop.


Also, instead of attaching each CSV individually, you can use the "Files by Workato" connector to create a single zip file containing all of the CSVs. Set the File List input mode (click the three dots on the right of the File List section) of the connector to "Dynamic list" and feed it the list of attachments. It will output a zip file which you can then attach to the email and you're all set.


Hope this helps!


-Gary

Thanks for the help, Gary! I guess I'm stuck on what workato connector to use and how/what field types to use for creating/accumulating the CSV files to that new list. Variables by workato allows arrays and objects but Lists by workato does not. I'd think these CSVs would need to be of the 'Array' datatype? Anyways, that's where I'm getting hung up as I don't see how to build that list of CSV files. Thanks!

gary1
Executive Chef II
Executive Chef II

If you already have the CSV data formatted as CSV (meaning it's not another data type you need to convert to CSV), then you can store it in any string/text field of a list or variable. You don't need to store it as any specific data type, or break it up further. It's possible to store tens of thousands of lines of CSV as a single logger.


For example, if you made a logger and added "1,2,3", this data is technically aready "CSV formated text", it's just stored as a string type. You could feed that logger into a CSV parser and it would work fine. Or you could do "1,2,3".encode_base64 (or [logger].encode_base64) to attach it to an email.


Are you trying to make a single CSV file, or are you trying to make many individual CSVs?



Multiple CSVs all as separate attachments. I did end up getting it to work just using the String datatype. Much appreciated!