My project generates report in online system and downloads the report. When report is downloaded, it opens in Excel and its window is visible. I need to delete the very 1st row in that report, worksheet ‘Worksheet’, but I don’t know how to refer to the report.
I’ve searched forum, got some ideas (Wait for Download, Read Range, Excel Application Scope → Insert/Delete Rows) but was not able to successfully apply any.
I’ve also created variables (report as FileInfo or Object) and outputs for further processing, but again - no success.
I would be grateful for step-by-step suggestions on how to move forward. After executing ‘Click chrome.exe PIM’ activity I can see excel report. What should be the next activities after presented click?
@rohith.prabhu Thank you for prompt response.
I’ve tried to use excel filename there, but I’m getting information that the file is already open. Because it is open.
Additional info: my project deletes all files from ‘Downloads’ folder at the very beginning of processing
In excel application scope you have to give the path with file name where it is.
1.1 Select the file and press shift+right click and click the copy as a path
@Gokul001 Thank you for your prompt response, too.
Yes, I’m using ‘Remove’ option for ‘ChangeMode’.
The main problem refers to ‘Excel file path’ rather, because the file is already open.
But why are you keeping the excel open? Or is it getting opened as soon it downloads?
You can use kill process activity to kill the excel application before the Excel application scope. So it will close all the excel files even if its open.
@Gokul_Jayakumar Thank you.
There are two challenges with your proposal:
Download filename differs for each report. I’ve tried to overcome this with createing FileInfo variable and refer to variable.FileName then. Error message says that the file is already in use (it is open).
I should close the open excel file before processing excel application scope. So, again, I need to refer to open excel file
If issue is in Picking th file name then use Assign activity
Assign
File_path = String.Join(“”, Directory.GetFiles(Your_FolderPath,”*.xlsx”,SearchOption.AllDirectories).OrderByDescending(Function(d) New FileInfo(d).CreationTime).Take(1) )
It will give you the latest downloaded file from your download folder.
Here Your_FolderPath is the folder path where the files will be downloaded.
(Ex : Your_FolderPath = “C:\Users\UserName\Downloads”)
Now use the File_path variable in excel application scope, it will work for you.