Copy a table from Word file

uiautomation
activities
studio

#1

Hi guys,

Do you know if it is possible for uipath to recognise a table within a Word document? Basically I need to copy a table from a Word file to an Excel file.

Here is the way my text file is structure (i changed it into a PDF to be able to post it on the forum only)example.pdf (76.4 KB)

So far I have used hotkeys to copy each text which is not really efficient… If someone found a way to work around Word this would be fantastic!

Thanks in advance for the help!


#2

Tried few things in the past, but was not able to reach the end. These inputs might help you:

  1. Try something like below in Code Activity (Didn’t try yet, I don’t see interop.Word on my machine)

     Word.Application wordApp = new Word.Application();
                 object filename = FilePath.ToString();
                 object missing = Type.Missing;
                 Word.Document doc = wordApp.Documents.Open(ref filename, ref missing, ref missing, ref missing, ref missing,
                     ref missing, ref missing, ref missing, ref missing, ref missing,
                     ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
                 Word.Table table = doc.Tables[int.Parse(TableNumber.ToString())]; //define this index depending on the number of table which you want to get
                 doc.Close(ref missing, ref missing, ref missing);
                 Marshal.ReleaseComObject(wordApp);
    
  2. Using hot keys

  • F5 --> Select Table --> Table Number will take you to the table.
  • I was unable to highlight the table using robot to select the table with below ways:
    —> Click below + Image which selects the entire timage, then Ctrl+C and Ctrl+V in excel :
    image
    —> Alt+numpad 5 (with numlock off) will select the entire table which I was unable to do with Robot.
  1. Read Text Activity (lot of coding required)

#3

Thank you! Will try this!


#5

Can U please Share Ur Work Flow ?