Copy and paste from excel to word using C# invoke code


I have one use case, which is I guess already used, that is

I need to copy one excel table into word file. Let me explain little bit further

I have one excel file, where in sheet1 I have one table, like the following

Here is the sample file for reference.

EmployeeDetails.xlsx (9.6 KB)

Now I want to copy and paste this table to one word file. the format would be same as it looks. Rather if I can they font and style would be same. This entire operation I want to do using invoke code, and the code would be in C#. Can anyone help me on this. It would be much appreciated, if I could get the help.


Hi @learning_sourav

I hope the below one can fulfill your requirement.

Thank you.

1 Like

Thank you @Jobin_Joy for this, but challenge is , I found this article previously, but I am not able to make it in uipath, as I am not much used to use invoke code. If anyone can help on that how execute this part of code using uipath invoke code. I would be grateful.

Also I did not find this namespace in uipath,

using Spire.Doc;
using Spire.Doc.Documents;
using Spire.Doc.Fields;
using Spire.Xls;
using System.Drawing;

can anyone tell is it available?

I found office.interop.Excel


@learning_sourav Please add this by Manage packages and then you can as a namespace. For that press CTRL+P and click on all packages. Search for “Spire.Doc” and install it. Later you can import the Namespace from Imports tab.

Thank you @Raakesh_Chaaloo for helping on this, but unfortunately I could not able to build the design of code, how to do the same. If anyone can share one sample code for the same, I need some guidance actually to do this process thrugh invoke code and if anything require related to that. Help would be appreciated.


Hi @learning_sourav

Please look into this to understand more about Microsoft Office interop objects.

Hope this will be useful. Thank you.