Club multiple folders recent file and create one data table

Hi All,

I am stuck with below scenario,

where i am having one result data table which get stored into one excel file as attached into different year wise folder respectively , now i want to merge all those different folders recent files into one file and then take out the email addresses from those merged table.

Please help me out.Output file.xlsx (9.0 KB)

@amruta_pawar so you have different Output excel files inside different years folder and you want to merge all of them and then take email addresses. Is my understanding correct

yes folder format is there is one parent folder as Output_File under that folder there are sub folders 2020,2019,2018 respectively and excel is there into those folders.

those years are dynamic

Refer this:

for getting latest file from one directory
so using for each directory use above then you can able to read all newest files from each folder then using append datatable you will get required output

So for this , First create a excel file with all the header that you need , this will be used as Final merged file
Suppose the file is C:\document\Outputfile\2020
then assign use array of string(z)= Directery.getFolder(“C:\document\Outputfile”)
the use For each to loop through z
again use loop For each by Directory.getfiles(item)
DT1(datatable) = new datatable
Use Read range acitivity and output is stored in DT1
append the DT1 to the excel file which you have created initial for final output file


how i will get to know from where to append when we will take next folder, plus we dont want to create new excel , we just want new dt from which we can take email adresses

can you please help me with append one

Are you able to read recent file from each folder
If yes
Then i hope you are going through for each folder so for 1st folder when you get latest file read that file using read range then append it to Output Excel file
(Note: If output excel is not present then make one variable before for each as IsFirst=“Yes”
then when you read that file use if :— IsFirst=“Yes” then use Write Range else Use Append Range After that use Assign IsFirst=“No”)

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.