I am new to RPA UIPath and want to understand UIPath by implementing simple bots. I want to build a bot which can help me to convert multiple word files in a folder to pdf? I have started the activity and for each item in Directory.GetFiles(“path”), what to do next?
Please help me in building 1st bot. Happy learning
Hi
Welcome to uipath community
Hope these steps would help you resolve this
—use a assign activity like this arrFiles = Directory.GetFiles(“yourfolderpath”)
Where arrFiles is a variable of type array of string
—then use a For each activity and pass the variable arrfiles as input and change the type argument to string in the property panel of for each loop
—inside the loop use Word package that go to design tab → manage packages → in official tab search as UiPath.Word and install that package
—now coming back to studio inside the loop use Word application scope and pass the input as item.ToString
—inside the scope use a activity EXPORT TO PDF where mention the file path to be saved with
This will convert all the word document in a folder to pdf files
I have created a bot as per your suggestions but it is not converting every document.
Its converting only doc extension, not docx. Also, the document is not getting saved in the folder which i mentioned. instead it is taking folder name as file name and converting
var files = Directory.GetFiles("C:\\path", "*.doc", SearchOption.AllDirectories).Union(Directory.GetFiles("C:\\path", "*.docx", SearchOption.AllDirectories));
Change the path and try.
Hi
here we need to mention the full path of the pdf along with the filename and the fileextension as .pdf
as you have left till word2pdf it has created the filename under the same
and as it is a EXPORT TO PDF activity even not mentioning the file extension it would have created on its own…
kindly mention the full filepath along with the filename and file extension
Cheers @jaswinder_singh1
Just one last help - I want all these files to be converted and kept under the folder? currently it is created in the desktop i.e outside of word2pdf , not inside of word2pdf
Awesome,
for doc file
kindly pass only one file path of word application scope directly and check whether that file from your folder is getting converted to a pdf, may be in a fresh sequence…apart from this
and
we need to check once the folder path like whether it is directing to desktop or to a folder