How to merge multiple word documents into single word document

Hi ,
I have multiple word file created on different paths.
I need to combine the multiple word documents into single word document.

May I know what is the best approach to achieve this in UiPath?
@aksh1yadav , @ddpadil , @vvaidya, @vikas_reddy_Vicky, @Vikas.Jain : Let me know your views on this.

Regards,
Sree

HI @Sree2311,

get all the document file path and store it in string.
using for loop → loop through it
use Read Text read the all content after the using Append Text activity append the the text in to one word file.

Regards,
arivu

1 Like

You should be able to retain the format(Colors,Tables etc) when you merge docs.

You can accomplish using Invoke Code if you can code.(google for VB.NET code)

or
Try this

3 Likes

It might be helpful to know that Word has features to insert multiple documents.

Go to Insert > Object Drop Down > Text from File > list all files then click Insert

Key combo to get to the option is
"[k(alt)]njf"

4 Likes

Thank you. This method works.

1 Like

Hi @arivu96 Can you please share the code for this?

Hi @vvaidya, Can you please send the code for merging different word docs into a single one

I’m not able to follow you, and the code would better help me. Thanks for your help in advance.

@MohithK

The method from Arivu96 and ClaytonM is to use the Insert Text From File ability in Microsoft Word.

If you attach to an open Word application window, and send the hotkey command provided by ClaytonM ( “[k(alt)]njf” ), it will open the menu to merge multiple word documents to the current open document.

Key strokes of Alt + n, j, f will open the Text from file menu

Once the window is open you simply need to select the files you wish to merge with the current file.

You’ll want to launch a word instance using Word Application Scope and use the Send Hotkey or Type Into command.

See if you are able to replicate in UiPath!

Cheers

1 Like

Thanks for your help @martinw3

Will try it and get back to you if I have any questions.