Extracting filename from folder to excel

Hi, I am extracting file names which are in a folder to excel sheet but the problem is by looping each and every file was printing in the message box but in excel it was not yet extracting It was only taking the last filename and printing in excel.how can I loop each cell to print filenames.Directory Get Files.xaml (8.3 KB)

You havent increment it in excel in write cell
so it is overwriting it

Hope these steps would help your resolve this
—use a assign activity like this
arr_files = Directory.GetFiles(“yourfolderpath”)
Where arr_files is a variable of type array of string
—now use a Buld datatable activity and create a datatable with column structure we want say two columns both of type stringamd get the output with a variable of type datatable named Finaldt
—now use a FOR EACH activity and mention the variable arr_files as input and change the type argument as string
—inside the loop use a ADD DATAROW activity and mention the array row property as {“1”,item.ToString} and in datatable mention as Finaldt

This will add data to the datatable one by one
—now use a WRITE RANGE activity and pass the variable Finaldt as input and add headers property enabled

Cheers @sainath2172

I used this but i was getting “B”+dt_Column(0)(0).ToString .Can you suggest any example@ImPratham45

Directory Get Files.xaml (9.3 KB)

1 Like

Its Extracting data to excel in the correct format. Thank you @ImPratham45

Welcome !!!

Happy Automation!

Can you pls help me how to extract files names from a folder and update these filenames in excel in column A and in column B update as “Pending” which is saved in outside of the folder

File extract.xaml (12.8 KB)

Oh gosh, I dont know if you’re still with uiPath but thank you!! This worked for me and I followed along for my own bot.

Great !!!:blush: