Converting an Excel file to a PDF /word file

excel
word
activities

#1

I am currently trying to convert an excel file I scraped from the internet into a PDF/Word file. I have tried the ‘Read range’, ‘Read row’ and ‘Read cell’ activities, but all resulted in errors where e.g. the datatable could not be converted into a string to write/type into the Word document.
Is there any easier way to convert an excel to a word/pdf file?


How to convert excel file which has data and image to PDF using UIPath
Is it possible to convert a excel file to PDF using UiPath
#2

Hi,
You might look at using the built-in features of the applications. Like you can import a spreadsheet into Word for example by using click and hotkey activities or even copy/paste.

I suppose if you want to convert the datatable to a string you could write it to a CSV then use Read Text File and it will save it to a string, but the cells will be spaced by delimiters.

Also, there could be some uses of LINQ functions to set up the data the way you want, but I’m not an expert on those.


#3

To convert Datatable to string use “Output Datatable” activtiy.


#4

Hi,
Thank you for suggestions. I have tried to use hotkey activities, and copy and paste, but I have run into problems. The software does not allow me to copy and paste the spreadsheet, it only allows me to select the entire window, which pastes to a word document as “ExcelBook1”, which is the name of the Excel document. The same problem exists with hotkeys. Do you have any suggestions as to how to overcome this problem? Thanks.


#5

Hi,
I have tried to do this, but have encountered problems. Using the “Read/select Range” activities, I get the error message that a String cannot be converter to a datatable. Using write csv, I get similar errors to do with strings and datatables. Any suggestions as to how I can rectify this?


#6

can you try like this.

  1. open excel file
  2. send hot key F12
  3. use desktop recorder and get the file name input box element in Save as dialog box.
  4. use input activity to send file name like this filename+(k[tab])p(k[enter]) – this will let u to select pdf option in format

Export excel to pdf
How to convert excel to pdf in uipath
Merging excel files
#7

Hi,
I managed to get it to work by exporting the excel spreadsheet as a pdf, but the resulting pdf was not well-formatted. I’ll try this now, thank you for the suggestion.


#8

If you have a PDF editor like CutePDF or Adobe Pro you could probably import the document.

It was also suggested that you could use Output Datatable activity. That converts the datatable to a string. However, all the spaces are replaced with commas.

If you are trying to use the copy/paste method, you just need to do a select all such as Ctrl+A, then Ctrl+C, and (maybe use the Get Clipboard to store it into a variable) then paste to copied table to Word or wherever.