Getting error while writing Data Table to excel

Hi Experts,
I am getting error while writing data to excel.
I am using(Get outlook mail messages) and I have created variable that variable called in Write Range Workbook.
I have passed below code in Starting Cell of Write Range Workbook.
“A” +(EmailsDT.Rows.IndexOf(email)+2).ToString

Where “EmailsDT” is variable of Get outlook mail messages and “email” is in from For Each Loop.

It’s showing error that “Rows” is not member of “List”. PFA snap.

What are the other options. PFA snap whole flow.



Hi @IT2_08_Saket_Maurya ,

Could you let us know what are you trying to perform ?

This Expression is giving out error since,EmailsDT is not a Datatable type variable, it is List(Of MailMessage) type. It does not contain the method Rows.

email variable/iterator is of type MailMessage and not a DataRow type.

Could you maybe make the following changes and Check if that is what you require :

  1. Keep the Build Datatable Activity outside and before the For Each Activity.
  2. Keep the Write Range Workbook Activity with Range as "" outside and after the For Each Activity.

Let us know if these changes make it work as expected.

Hi, Thanks for your reply sir.

Suggested changes done but still not working.

I wish to carry out the following task.

Using the “Get Outlook Mail Messages” activity, reply to any emails that were sent within the last few days (i.e. on a certain date) based on the email subject.

It will take the Subject line, Specific Date and Mail Body(for reply) from excel named as ReplyMailToAllPreviouslySentMailOnPartularDate.

Above task is working perfectly but below not working.

After responding to every email, I want to keep track of the sender, the date the email was replied to, the subject,
and the hard-coded Mail Sent Status(like Mail Replied Done)
in a separate Excel sheet called “Mail Sent Status.”

Attaching the task. Please check and suggest what changes can be done.

Main.xaml (24.0 KB)

@IT2_08_Saket_Maurya ,

After performing the changes, what was not working ? If you have received an error let us know the error message received. Screenshots would be helpful.

You could Check with the updated workflow below :
Main2.xaml (24.6 KB)

Since there was combination of Excel & Workbook Activities, I assume that would have caused an error. Try with only Workbook Activities at first, if it does satisfy the requirement you would not need to switch to Excel activities.

Let us know if the updated workflow does not work as Expected.

Hi, PFA error snap.

@IT2_08_Saket_Maurya ,

Apologies. Could you move the Build Datatable Activity inside the For Each Row Activity and add it before the For Each Row in Datatable like shown in the image below :

Same error showing.

Error snap.

@IT2_08_Saket_Maurya ,

Could you Check the values of the datatable in the Immediate Panel as you are in the Debug Mode ?

Also check if there are Duplicate variables created in the variables Panel.

Hi,
Issue has been resolved. There was space between double quotes(" “) inside the Write Range Workbook activity. After removing space between double quotes(”"), it’s working.
Thanks for your help.

1 Like

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