How do I convert variables obtained from email and transfer to excel?

Hi All

I have a list of emails which I have used RegEx (Match & Replace) to obtain 3 variables which I need. How do I transfer the variables to excel?

What I have done so far

  1. Get Outlook Message
  2. For each email, get the variables using RegEx (Match & Replace).

Where are these regex variables variables being stored as you loop through the emails? Are they inside a datatable? Matches activity returns a types of Ienumerable which stores all matches from the string that is passed to it. Are you already changing this to type string or are the variables still left as is?

In addition to what JoepshNehl said, once the results are available from Matches activity, you can use a For Each loop on the result along with Excel Activities to write the data into an Excel file.

1 Like

Hi Joseph

They are not yet stored to database. Should I use “build database” and store the variables? The variables are type string.

Please see below for the screenshots

Hi ankit, once the results are out, should I store the variables to a database table first, before exporting them to excel?

Storing them in a DataTable does make it easier to write to Excel. You can also write individual cells as well.

This is what you can do create a DataTable and then write it -

Make sure to select TypeArgument as String in the “Add Data Column” activity - image

Hi Ankit

Thanks. Can I ask at which stage should I create the data table (indicated as “New Data Table”).

It depends on how you want to write the data. If you want to write for all emails together, then create it before going through each of them. If you want to write them individually, then after extracting each mail.

Hi Ankit… so sorry, I am still unable to write for all emails together, build a datatable and go through each of them. Possible to provide me a demo file ?
What I have done is

  1. Get Outlook Mail Message
  2. For each mail, use RegEx match and replace to obtain the email address from the body of the email.

Hey @afinity_lim

Check this tutorial out - hopefully it helps…

Cheers Steve

2 Likes

Hi Steve

Thanks for the guide! Very useful and it helps!

1 Like

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