Email Subject lines added rows

Hello all,

I have a question about adding emails rows to a spreadsheet. I would like to get outlook mail messages that are in the pending category to go into a spreadsheet and a days pending column starts automatically at 0. The next day when the bot runs if the email is still pending and using a subject line as a unqiue identifier, then the days pending column should go to 1 and increment +1 each day it’s still pending. Here is an example of what I am looking for. I have everything working except I cannot figure out the increment part. I used Convert.ToInt32(existingRows(“Days Pending”))+1 but not having any success.


This could be for the first run. And then the next day it should look like this.

@srobey888

Are you using for each row in excel and incrementing inside it? If not this should work

Cheers

I have gotten this error for dtExisting.Select(“[Subject] = '” + mail.Subject + “'”)(0).
Assign: Index was outside the bounds of the array.

@srobey888

As per error it means the mail.subject you are trying to find is not matching with any value

Cheers

is there a way to simply the formula. I am not exactly sure why I need the + “'”. I just need to look at existing rows and see if they match.

@srobey888

To say it is a text you need to add aingle quotes

Also You can filter using filter datatable also and then check the rowcount of the filtered table

Cheers

@srobey888,

If you are going to recreate the file based on pending cases and if you want to calculate Days pending from the email received date then, you can do this calculation in DataTable and just write it at once.

If you are going to add cell by cell then you should be using excel formula like this:

=DAYS(TODAY(),B2)

Thanks,
Ashok :slight_smile:

1 Like