I try to find a solution for the following:
My Bot opens a browser-app and at the end he downloads an Excelfile. So the Excelfile is on the screen now and i need to read data from it. I have no Excel Application Scope! The name of the Excelfile changes every time so I cant use the path for using Excel Aplpication Scope.
Is there a way to getting data from Excel without using Excel Apllication Scope?
Just wanted to Know whether Wait For Download Activity is being used in this case, Or if possible to Shift to Wait For Download Activity, since it Provides the Path of the Downloaded File, Once it is Downloaded.
You could then Kill the Excel Process if the Excel is being opened, then use Excel or Workbook Activities to read the Downloaded file.
We can retrieve the file with this snippet of code →
Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)+"\Downloads","*.xlsx").OrderByDescending(Function(w) New FileInfo(w)).First()
Basically it will retrieve the latest Excel File Path in the Download Directory.
Another approach, would be to use a Get Attribute to retrieve the href component and then use the HTTPS Request Activity to download the File(Resource Path).
This approach is much more robust, and I’ve used it in several of my projects.
Thanks Ashwin! If I understand it right, there is no activity getting data from Excel if we dont open the file ourthelves.
So I have to follow the way picking up the downloaded file. But the Bot will run on a terminal server where I cant be sure that admins will switch the download directory. At first I will give Wait For Download a change…
@ashwin.ashok and @supermanPunch
Thanks for your quick help. I found a solution via stroring the file in the download directory and than open it with Excel Application Scope for getting the data.