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.

image
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

@Anish_Kumar2

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.
“Abc@gmail.in”,“Abcd@gmail.in”,“Abcde@gmail.in” beacuse in gsuite mail input like that
{“Abc@gmail.in”,“Abcd@gmail.in”,“Abcde@gmail.in” }.

@Anish_Kumar2

Try this

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

@Anish_Kumar2

If you want output like this then try this query

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

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

and I am using this code.
image

@Anish_Kumar2

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

Cheers

@Anish_Kumar2

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