Sending mail in gsheet send mail activities

Hello, Team I have an excel spreadsheet with a mail id column that has 300 to 400 rows. I’d like to add all of those email addresses to the cc list. I have attached a input ss for your refrence.

please help me on this

Hi @Anish_Kumar2

You can try this query to store all mail id’s in a variable then send it.

String.Join(";",DT1.AsEnumerable().Select(Function(row) row("Email").ToString))

Note: If you want to send unique mail id’s then use below query

String.Join(";",DT1.AsEnumerable().Select(Function(row) row("Email").ToString).Distinct())

Hope this helps!!

how we remove that last comma, can you please help me on that


In last it is not adding ; please refer this image

String.Join(";",DT1.AsEnumerable().Select(Function(row) row("Email").ToString))

and I want this type of output.
“”,“”,“” beacuse in gsuite mail input like that
{“”,“”,“” }.


Try this

"{""" + String.Join(""",""",DT1.AsEnumerable().Select(Function(row) row("Mail").ToString).Distinct()) +"""}"


If you want output like this then try this query

String.Join(",",DT1.AsEnumerable().Select(Function(row) """"+ row("Mail").ToString +"""").Distinct())

In my case, why is there a backward slash at the beginning and end?

and I am using this code.


In gsuite you need a string array …so please use this directly and it should work…you dont need string.join at all

readDt.AsEnumerable.Select(function(x) x("RM Email ID").ToString).Distinct().ToArray

If you are getting blank values in the email id column then first use a filter for blank values or in linq we can handle those as well

readDt.AsEnumerable.Where(function(x) Not String.IsNullOrEmpty(x("RM Email ID").ToString).Select(function(x) x("RM Email ID").ToString).Distinct().ToArray

Hope this helps



Can you try to use Message box or Log Message activity to see the output