MS word file replace keyword & send by E-Mail with same format

Hi Guys,
I have one business scenario where business gave one MS Word file where will replace start date ,End date,Project name & link at the time of automation .
paste same formatted E-Mail in outlook and send to the client. previously I was using notepad to achieve this but client required same formatted template in E-Mail.

1 Like

Great @Aleem_Khan

We can use HTML formatting here with dynamic variable addition.


could you please share workflow

Dear Aleem,
Extract the data from the word.
Remove the first start date, end date and project name from the extract or Replace with Start date - {0},
End Date with {1},
and Project Name with {2}

Then use String.Format(strExtractedDataWord,varStartDate,varEndDate,varProjName)
Pass this above line in the Mail Body

We are using the below concept:
String.Format(“{0} - {1} {2}”,“Aleem”,“Happy”,“Automation”)
Output- Aleem - Happy Automation

Geetishree Rao


This can done with UiPath word activity
Go to design tab in studio → manage Packages → All Packages → search for UiPath.Word.Package and install it

  1. Then use a Word application scope and pass the file path of the word document

  2. Inside the scope use a REPLACE TEXT activity to replace the text you want

  1. Then we can read that text with READ TEXT activity and get the string output

  1. Now finally pass the above string variable as mail body in any of the SEND MAIL activity

Hope this would help you resolve this

Cheers @Aleem_Khan

1 Like

Hi Guys
Hope you all fine , I have scenario where I need use E-Mail template and replace some dynamic data in E-Mail template using unique keywords. I replace all keyword using replace activity of MS Word in MS Word application scope but one replace activity I am getting error.I contain some HTML code in this variable

Hi @Palaniyappan ,

I have the same scenario and tried the above mentioned steps. I am able to get the data but the formatting available in word document is missing in email body while sending email.

Can you please let me know how to send with same formatting available in word document?

Thanks in advance!

1 Like

Hey Guys, i had the same issue,I was able to solve it by :
WordApp Scope>Save Document as
then > replace text in document
then >saving the document
then > sending the email(SendMailX) and ticking the Word Document radio button and pointing to the newly saved word document