Multiple replace text in Word with for each function

Hi,

I have a flowchart where I would like to replace some text in a Word document based on a Excel list.

The flowchart has to perform some certain actions for each line in the Excel sheet. It has to copy the file and name it and replace some text in the Word file. However in my For Each function I can only get it to replace the first variable. I tried to have multiple for each function within each other, but I can’t seem to get it to work.

When testing above robot, it does simply replace the 3 last replace texts with “System.Object” in the word file.

How to solve this?
Let me know if I need to send the file.

Thanks.

2 Likes

Hi @stch
Maybe you can send the xaml file to easily address the issue. Thanks

cheers
Happy learning

2 Likes

Main.xaml (10.9 KB)

@pattyricarte
Of course, here it is.

Thanks.

1 Like

Hi @stch,

May I know why the variable are IEnumerable type.

The Replace text activity requires a string variable. Which means you need to pass the string variable.

For example:

ChangeSalary = “This is my change salary replace text”

Where ChageSalary should be of type string and not IEnumerable.

Regards,
Sasikumar K

1 Like

Hi @Sasi.lalo

Are there any way to get around this? Because I’m using the read column function it says I need to use IEnumerable.

Capture

Essentially I just need to replace some texts in a Word document created for each person based on a single Excel input. Output should be attached with the Word filename as the persons name.

Capture2

I can get it to change the names in the for each, but not the other text.

1 Like

Hi @stch,

What is the structure of the excel file? and how you planning to proceed. The Read Column read entire column. (A2 to end of column). Either you can read cell if you know the cell range or read the entire excel sheet as data table and then extract the data you need. Please search in the forum on how to read the excel sheet and working on data tables.

Regards,
Sasikumar K

2 Likes