Send Email by using Excel data

I want to send Outlook email by using Excel data.
Send emails 2 days earlier than date data automatically.
Teach me the process.

  1. To find date, what do I have to use? Output of ‘ReadRange’ is ‘Datatable’, so I can’t insert it on ‘If’ because, it needs ‘string’
  2. How can I find 2days earlier data?
  3. How to Send emails using the email address written on 3rd column?

excel

Hi @111153

Step1: Read range the excel using excel or workbook activities
Step2: use for each row of the readDatatable.
Step3: If condition inside the body of the loop.
Condition Currentrow(“Date”).toString.Equals(Now.addDays(-2).toString(“yyyy-mm-dd”)
Step4: Send outlook message To mail Currentrow(“Email”).ToString

Regards

Thanks for answering. I added some pictures.
Is ‘Each row’ functioning for find email address on 3rd column??

Hi @111153

Yes!

Its Specifying the Column index row(2).toString or row(“Columnname”).toString

And You need to use if condition inside the for each loop so that it will iterate through

The column date and if the condtion matches it will fetch the corresponding date column Email id.

Hope this helps!

Regards

1 Like

Hi @111153

I have created a Skeleton for based on your process.

Process with necessary inputs!

Refer to the xaml below!

Test_Sequence1.xaml (8.0 KB)

Regards

Hi @111153

Let me Know if its work for you!

Regards

Now I commute and check your solution. Sorry for late and thank you so much.

But… I got some errors yet :frowning:
when I run this file, Error on if condition, “Column ‘Date’ does not belong to table DataTable” Even though there is Date column. So I changed if condition ‘DateTime.ParseExact(Currentrow(1)~~~’
then Error comes with ‘String was not recognized as a valid DateTime’

Hi @111153

As you see the date column is in index 0 but you have chosen a 1 in currentrow(1) and it indicates the name column

Please try with currentrow(0) in the condition

Hope that clears your issue!

Regards

Sorry for bothering you. I used…

DateTime.ParseExact(Currentrow(0).ToString,“yyyy-MM-dd”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd-MM-yyyy”).Equals(now.AddDays(-2).ToString(“dd-MM-yyyy”))

→ If:String was not recognized as a valid DateTime. :joy: :sob:

I tried by using this one too, but I got the same result :frowning:

DateTime.ParseExact(Currentrow(“Date”).ToString,“yyyy-MM-dd”,System.Globalization.CultureInfo.InvariantCulture) = Now.AddDays(-2)

Hi @111153

If possible can you share me your source excel file that you re using?

Regards

example.xlsx (14.8 KB)

can you donwload this?

Hi @111153

Try with the xaml below.

If the Condition matches then send Mail using Mail Activites.

Main.xaml (7.1 KB)

Regards

OMG It works! really thank you !!!

what was the problem of ‘DateTime.ParseExact(Currentrow(“Date”).ToString,“yyyy-MM-dd”,System.Globalization.CultureInfo.InvariantCulture) = Now.AddDays(-2)’??

what’s the difference of using ‘dateParse’ and ‘DateTime~~’?

Hi @111153

Datetime.ParseExact means parsing the Date to specfied format!

check with the below thread it has a video reference

Kindly refer to it!

Please mark solution to the post which you find desired!

Regards

1 Like

Thank you :slight_smile: Have a good day

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.