How to add multiple file path from local machine to single excel cell

First I am downloading multiple files in my local machine in specific folder and after that I am fetching one my one file path and file name by using for each loop and now I want to add all the file path and name in single excel cell

Hello @Saket_Kamble,

This seems like an odd request to me? But yeah sure.

After downloading all the files to a location use this;

ar_str_FilePaths = File.GetDirectory(str_FolderPath)

str_FilePaths = nothing

For Each item in Array
str_FilePaths = Item + str_FilePaths

That should work!


If I am right, basically you need to add all the file paths of all files in a folder to an excel cell.
For that, you can follow this method:

assign a String var = String.join(" ",directory.getfiles({FolderPath}))
This will give you a string with all the files in the folder path “FolderPath” separated by space.
Write the var to the Excel Cell.

Hi Bro.

Easy sample as attached file.

Pls change your path in code.
Loop (82.4 KB)

In More Detail
Here we have Account Number List for one account Number first, It will create folder in local machine by one account number name and then there is multiple files we have to download that files will get downloaded in that created one account number folder then we have to fetch all the files path and files name from that one account number folder and here I am fetching files path and name using for each loop But know I want to add these file path that we are fetching using for each loop in single excel cell all the file path that we are downloading for one account Number to single (only one cell) excel cell then again for next account number the process goes same. here I am able to fetch path from one account number folder through for each loop but not able to add that all files path in single cell, while doing this only last file path I am getting in single excel cell.

The Problem is How to add those files path in single excel cell one by one


I wouldn’t do it one by one. Accrue all the filepaths into a variable and once done I would write the contents of the variable into the cell using the write cell activity.


yes you are right sir, but with file path we have to add that file name as we like this
FileName: abc.pdf, FilePath: C:\Users\xyz\Downloads\PdfDocs\AccountNumber111\abc.pdf

Hi Bro.

You can write one by one path file into one by one cell… and the final step, you can loop cells which contains file path and add them into array, then write array into one cell you want.

Or basically you can get all filepaths in a folder to a variable using
String.join(“ “,directory.getfiles(foldername))
Write this variable to excel cell

ar_str_FilePaths = File.GetDirectory(str_FolderPath)

str_FilePaths = nothing

For Each item in Array
str_FilePaths = Item +environment.newline+str_FilePaths

is there any other way like first we add all files path file name in json format and then put it in excel single cell, it is possible