Multiple excel reading

Hello guys,

i have an input folder with multiple Excel(Xlsx format) with different name.

Now RPA sholud read the first excel and process the data from that excel and move that excel to archive folder using Reframework.

So how can i read the first excel file from a folder containing multiple excel irrespective of file name.

@Gokul_Murali Do you want to read latest Excel?
This expression returns latest file from folder
**str_filepath = Directory.GetFiles(yourfolder_path,“*.xlsx”).OrderByDescending(Function(d) New FileInfo(d).CreationTime).Tolist(0)**

Hi @Gokul_Murali

Take a assign activity and create a array variable and store all the files in a folder. Use the Directory.getfiles(“Give the folder path here”). Use the for each loop activity to iterate array variable. Get the each array item which contains the excel file path. Use the read range workbook activity to read the current excel file.

Hope it helps!!

@raja.arslankhan
I want to read the first excel from that folder

@mkankatala

do you have any workflow related to this.

@Gokul_Murali
Try this one

@raja.arslankhan

so i can use this expressing in the assign activity,

it ill give the first excel path right.

Hi @Gokul_Murali

I don’t have sample workflow.
I have another idea. Take a Build datatable activity and add the column as File Path and save it as datatable. Take the assign activity and create a array variable. In array variable store the folder path like Directory.getfiles(“Give the folder path here”). Use the for each loop to iterate the array variable. Use the Write cell activity to write in the File path column in created datatable and check the auto increment row option for write cell activity. Then one excel file is created with the file paths. Use the bulk add queue item activity to push the excel data to the Queues. Up to this process has to be develop in first run in initialization state. then do the next reading of each excel file in process state, use the each queue data to read the each excel file.

Hope it helps!!

@Gokul_Murali yes same as I mentioned above in first post. use like that

Hi @Gokul_Murali
If you want to read only first excel file without any order basic
U can try just

str_filepath = (Directory.GetFiles(yourfolder_path,"*.xlsx"))(0)

Note: str_filepath variable type = string

Thanks
VP

@Vishnuraj_Pandiyarajan2

What you mean by the “" in ".xlsx”

@Vishnuraj_Pandiyarajan2

i mean the star symbol in .xlsx

“*”—>Get any file with have extension of “xlsx”

So u can use “*.xlsx”