Read and split data from excel

I have to read the excel file which Cell has for ex: - Outlook Email

I want to read only 1st word after the - i.e Outlook in this example

@avinash.wankhede

For reading the cell value you can use read cell activity

And then to extract the required value, say the cell value read is stored in str then

System.Text.RegularExpressions.Regex.Match(str,"(?<=-\s+)\w*").Value

Cheers

Hi @avinash.wankhede

Store the Outlook Email in a string variable like Variable

Assign -> Variable = "Outlook Email"
Assign -> Variable = Variable.split(" ").First

In this i used split function to split the two words by using the space and took the first one.
Check the below image for better understanding

If you want to take the Email from Outlook Email use the below one

Assign -> Variable = Variable.split(" ").Last

Hope it helps!!

@avinash.wankhede
Hi,
Use read range
In for each loop take assign Content=CurrentRow(“ColumnName”).ToString
System.Text.RegularExpressions.Regex.Match(str,“(?<=\w+\s+).*”).Value

Hi @avinash.wankhede

Use the following regex expression:

System.Text.RegularExpressions.Regex.Match("Outlook Email","[\w]+(?=\s)").Value
Output: Outlook

System.text.RegularExpression.Regex.Match("your string Input","(?<=\s)[\w]+").Value
Output: Email


Hope it helps!!
Regards,

Hello @avinash.wankhede
To read the Specific Cell, you can use the read cell activity and store the value in a variable.
By using Regex you can achieve your requirement.

System.text.RegularExpression.Regex.Match(ReadCellStr,"(?<=-\s)[A-Za-z.0-9]+").Tostring.trim

currentItem.ToString().Split(“-”)(1)

with this I am spliting the - and reading the enitire text after that - i.e outlook email.

I need only OUTLOOK word

Use the split like this
CurrentItem.ToString.Split(" ")(1)

Could you please which have to be take to extract the outlook. Please give the exact text with in double quotes

@avinash.wankhede

Store the Outlook Email to a variable.

Word = "Outlook Email"
Reuqired Data = Word.Split(" "c)(0)

Regards

“2023 - Outlook Email” is there but from here I need only Outlook

Okay then

Assign -> Variable = "2023 - Outlook Email"
Assign -> Variable = Variable.split(" ")(2)

You can use the below regex expression too
image

Hi
(?<=-\s*)[A-Z]+[a-z]+(?=\s)

Thanks

@avinash.wankhede

Please try this…this would work as you need

cheers

Hi @avinash.wankhede

Try this
Valg.Split("-"c)(1).Split(" ")(1)