How to extract subject info into excel sheet?

Hi Community,

Happy New Year:-)

I have this below shown mail subjects which have Incident Type, Task ID, Status and Name.

image

I have to read each subject lines and save data in respective cells in Excel.

image

Using Get imap mail message activity i’m able to read the subjects. But stuck at writing data into excel.

image

Please help me what would be the condition to extract each part of subject line and save into excel sheet.

Thanks in Advance:-)

Hi @Vaishnav_Tej
Build datatable with the column name
For each mail in mail message
Arrcontent=Mail.subject.tostring.split(“|”)
In Arrcontent(0)=type
Arrcontent(1)=taskid
Arrcontent(2)=status
Arrcontent(0)=Name
Add each content to data row using add datarow activity

Hi,

I have a doubt.
Arrcontent is of type Array right.
So, it can have only similar data type values.

When we have different data types in Subject line , How to read the data?

@Vaishnav_Tej
Yes,it is array of string
You can store the content as string data type

So you mean it works for all type of data like int, boolean , object, etc., ?

@Vaishnav_Tej
I mean store all the content as string and make all columns datatype as string in builddatatable activity

Yes I understand that. Just I wanted to know if different data types exists in subject line how to write the condition?

image

How to avoid that empty row in the excel ?

@Vaishnav_Tej Convert string to other datatype before adding it to datatable if datacolumn datatype is different

Check builddatatable activity if any empty row was added while creating the datatable @Vaishnav_Tej

1 Like

Hi,

If mail has other type of Subject mails, it is throwing error.

image

image

Hi @Vaishnav_Tej ,

Try to split it with “|” and assign to respective column as table.rows().item(“Columnname”).tostring=split value or with for each row as row.item(“columnname”).tostring=split value

thanks

Hi,

Can you show with example because it’s very confusing to me.

sure @Vaishnav_Tej . will share soon!

If the mail subject has | the code will work otherwise you need to make change for other type of email

@Vaishnav_Tej Sorry for delay . please find the below solution

Thanks