Read multiple word file from folder one by one

Installer(.exe or .msi):

License type(Free, Trial/License code):

Studio/Robot version:

Current behavior:


Hi All,
I want to read multiple word file which exist in a folder. and In this folder we have different kind of files like word , pdf and excel, but want to read only word file and there may be 0 file , 1 file or more than 1 word files .so please help me how to do that in uipath studio.

string[] files = Directory.GetFiles("D:\", "*.docx")

files.Length will give the count of files.
The above expression will filter all the files ending with docx extension.
Create one array variable, and use assign activity.


To read Word files from particular folder:

str wordFiles = Directory.getFiles(“folderPath”,"*.docx")

Hi Thanks @lakshman @KarthikByggari for help…
I have tried that as suggest both of you but i am not getting the result.
for reference please see below:

kindly help me…
is it possible can I get the complete solution its helpful for me.


What error are you getting. Have you declared word variable is of type string array or not ?

And also check one more thing your word file extension is .docx or .doc

yes, word variable is declare in string array and the file extension is in .docx


Could you please share your workflow and will check it and let you know.

I am not able to upload my workflow.

and I am attached an screenshot that whats the error in workflow.


Please find the attached workflow for your reference.

WordFiles.xaml (7.1 KB)

If it satisfies you then close this thread by mark it as solution.

Now its working fine.
Thank you so much for help.

1 Like


Please close this thread by marking above one as solution.

actually, my word document is in not always in .docx is in different different properties like its also in .rtf so in this scenario what i have to do.
please, help me in this issue.

Please anyone help me in this issue, i have an word files in different different properties like(.docs, .rtf etc) and i have to read all word file in folder.

@Meenakshi6246 In the folder what are remaining file types that you needs to pass.?

i have need only read the all word file path and it is in .docx, .rtf .

@Meenakshi6246 Hope attached zip file meets your requirement.Let me know for further help. (30.3 KB)

Actually , i don’t want to use if-else condition,if is possible there is in add the query in assign activity . so please let me know

@Meenakshi6246 Can you specify what query you needs to add

WordFiles.xaml (8.5 KB)

is it workflow i have to add the different properties of word documents except .docx