Delete row in downloaded excel file

Hi Devs,

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?

Thank you in advance for any suggestions,
Kaz

@kgkorespondencja - In your workflow for Excel application scope provide the downloaded excel file path and try.

Ex : “C:\Users\UserName\Downloads\Test1.xlsx”

Hi @kgkorespondencja

Insert/Delete Row activity properties

Change Mode → Remove

Regards
Gokul

@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

Hello @kgkorespondencja
Try this method

  1. 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
    image
    1.2 paste it in excel application scope
  2. Use insert or delete activity

@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.

@kgkorespondencja ,

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.

Hi @kgkorespondencja

Try to use Kill process activity

image

Regards
Gokul

1 Like

@Gokul_Jayakumar Thank you.
There are two challenges with your proposal:

  1. 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).
  2. I should close the open excel file before processing excel application scope. So, again, I need to refer to open excel file :frowning:

@kgkorespondencja

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.

1 Like

@rohith.prabhu Yes, your solution works for me!
Thank you for your detailed support

1 Like

@Gokul001 Thank you for your suggestion. It is good.
I have found the detailed solution in the other response.

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