Excel cells replace readymade XML tags

Hi everyone

Can you help pls; I want to read cells from Excel and use cell content to replace a predefined XML tag content with those.

So, if I have an Excel cell with content: “myname@domain.com”, I want to use that string in a readymade XML like:
(Original tag)
emailadress@here.com to

(cell from excel)

The current problem is that I do not know how to write into XML those values so that the XML keeps it integrity.

I have already Uipath reading excel and assigning cells to variables ok. How I can out those into predefined XML replacing original tag content?

Any ideas, folks?

please use </> format button from editor when sharing XML snippets. If possible share the entire XML as file with us. thanks

I can´t share the actual code but this is the basic idea. Thanks for noticing, I corrected the original post to show the tags…

not sure, if the corrected XML was formated. However in general at least two options are available.

String Replacement on Placeholders

  • Define a text template with placeholders <abc><email>#EMAIL#</email></abc>
  • read in the template (e.g. from a textfile) or use the string
  • Do the replacement: myTemplateString.Replace("#EMAIL", strValueFromExcel)

XML Approach

  • deserialize XML with the Deserialize XML Activity from UiPath.WebApi.Activities Package
  • grab the element
  • replace the value


1 Like

Thanks, I will try that. I already tried to edit a text file with variables. But not with this way.

Yeah, String replacement with placeholders was the thing.

I made a text template in directory NN. Content is in XML format and tags have placeholders.

Then I read the excel file & convert it cells to variables. Then I read that text file in.

Then “replacing text” with variables. Then saved the result text as a XML in target directory. Couldn´t be more simple.

At first I overthinked and tried to use “create HTML content”. What a mess that was ;-D

Thanks @ppr for advise, much appriciated!

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