How to print the name of a list with the name of all the files that are inside of a folder

excel

#1

Help! I’m new on this and I’m trying to make a file with all the excel names that are in a folder. I just can see the name of the excel files in a Write line but I can´t printed in an excel!! can you help me?


#2

@denisselizeth I guess you are using System.IO.Directory.GetFiles(“YOURFILEPATH”) to retrieve files from folder.

THe result of this will be an array of strings. To write into excel, either you convert this result to a data table and use write range activity. else loop through array and use write cell activity to write the values.

My suggestion is to use write range because in write cell activity you need to hit the excel file multiple times.

Please let me if it helped. If not, please mention which part you need explanation for.


#3

Yes @Madhavi is a Directory.GetFiles! Actually I’m trying to build data table but still not working. should I assign the variable again?
list of files.xaml (11.3 KB)


#4

Hi.

You could also join the array of files together then use Write Text file using .CSV as the extension.

To join the array you can use String.Join( )
So it might look like this:

String.Join(System.Environment.Newline, System.IO.Directory.GetFiles(“YOURFILEPATH”) )

Then put that in the Write Text file activity.


#5

@denisselizeth You have put write range inside for loop and you were also not adding the files as data row. I have updated your xaml file. Please check list of files.xaml (12.3 KB)


#6

its working!!! thank you so much!! :smiley: