Hi All,
i am saving email attachments(excel) in folder using bot…now i want to open those one by one using for loop ,but robot don’t know their name…its happening run time…so how can i give the file path and how to open those one by one …please suggest?
So you know where the files are saved. In that case we can get all the files inside that folder using the below code.
Within the for each loop, you can use excel application scope to open the file. The file path will be in the item variable of the for each loop. If you want to read the file without opening it, use Read Range and give the file path
Directory.GetFiles(YourFolderPath)
This will give the path of all the files in that folder as a string array.
Now use a for each loop to loop through the array.
Hope another topic was opened by you in the same topic but with few more updates
But the same would apply here
Please follow the below steps
— once the files are saved to a folder, use a assign activity like this
Out_Filepatharray = Directory.GetFiles(“yourfoldername”,”*.xlsx”)
Where Out_Filepatharray is variable of type string array that store the value of file path as a array
—use a for each loop and pass the above variable as input and change the type argument as string In The property panel of for each loop
— inside the for each loop use a excel application scope and pass the file path as item (the variable from for each loop which has the file path that we are going to open one by one no matter what we know the name or not)
— inside this scope use a read range activity and get the output with a variable of type datatable
— use a for each row next to this read range activity (while we are still inside the for each loop and excel appli Scope) and pass the datatable variable as input
—inside the loop use a open browser loop and pass the value of url as a string between double quotes
— inside this open browser loop to pass the value of each row of a column we want in type into or to a assign activity with a variable put the value like this
row(“yourcolumnname”).ToString
That’s all you are done
Hope this would help you
Kindly try this and let know for any queries or clarification
Cheers @Dhananjay_lavate
Hi @Palaniyappan, Thank you so much for above flow.
have created same flow but i am getting error while reading cell from datatable of excel …i have attached my below excel template …i need to take data from that excel and need to patse in web…can you please help in to provide rane of databale .
Throwing error: Assign: Column ‘A61’ does not belong to table .
Please suggest what can i do.Thanks
SPLUS_ORder_request__form2.xlsx (13.3 KB)
@Dhananjay_lavate
Is “A61” is column name in your excel?
If you want A61 value (username in your excel), you can use Read cell activity
Hope this helps
Thanks
Aman
In the assign activity, Please write
row.Rows(57).Item(0).ToString in the place of row(“A61”).ToString
It will provide you the username.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.